One data context for multiple Controls
-
Hello, I have a window and a user control in side of the window. I want to set the same ViewModel class as a data context for both,the window and the user control. how can i do it? Thanks
-
Hello, I have a window and a user control in side of the window. I want to set the same ViewModel class as a data context for both,the window and the user control. how can i do it? Thanks
Data contexts are inherited. the data context for a control is automatically passed into all it's children unless it declares a different one for it's own. So the data context for the window is automatically inherited by your UserControl. PS: I assume your UserControl is a child of the window
-
Data contexts are inherited. the data context for a control is automatically passed into all it's children unless it declares a different one for it's own. So the data context for the window is automatically inherited by your UserControl. PS: I assume your UserControl is a child of the window
Thanks!!!