I’m trying to understand WPF in details. So far I don’t know how work 2 things:
1.Where Dependency Property (DP) is stored?
My guesses: DP is static, so this object (DP) is same for all objects that are derived from class, that have this DP. I suppose that DP has its own storage, where DP saves values for all objects that use this DP. Mb sth like dictionary…
2.How the Grid can assign an object (for example Button) to its own row (in details)?
My guesses:
Button Grid.Row="1" (in XAML)
SetRow (from Grid) will be executed. PropertyChangedCallback (initialized in metadata) will be triggered also. I suppose that Grid will assign Button by some code in this Callback, but it makes no sense for me… Callback will get DepedencyObject (= Grid instance) and EventArgs (= value). How grid can know which object changed Attached Dependency Property? Grid should have its own storage for objects position… How does Grid save that information?
Thanks in advance for explanation.
VisualTreeHelper.GetParent). The mechanism probably works via looping through theGrid.Childrenduring the layout pass and getting the properties of those to determine where everything should go.