Hi
can any one tell me what is DependencyObject and whay use this and where need this and also dependency property.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Priya LingePosted Nov 2, 2011, 6:56 AM
1.a Dependency Property is like any other property but can hold a default value,
with built in mechanism for property value validation and automatic notification for changes in property value .
any binding in silverlight is to binded to a Dependency Property.
Dependency properties can hold an optional default value, and can propagate the default value down the element tree.
Example :
Suppose we create 1 button dynamically and we want add that button
in grid .
Grid.RowProperty,Grid.ColumnProperty is the most common dependency property.
Before we add the button to the grid.children collection, we can set this row/col properties like:
btn.SetValue(Grid.RowProperty, 1)
btn.SetValue(Grid.ColumnProperty, 1)
then we just use myGrid.Children.Add(btn) and the button will get to the correct row/column "of the grid".
Samething with Canvas.
we can add button in canvas using their dependency properties like
Canvas.LeftProperty
Canvas.TopProperty
Please check below link for more information.
http://geekswithblogs.net/Silverlight2/archive/2008/12/24/understanding-dependency-properties-in-silverlight.aspx
Hope this will help you.
Thnaks.