Im trying to figure out how to accomplish the following. I have a window that will host a number of different UserControls that will be loaded at runtime. When I create the controls (in code), I want to bind a SelectedDateTime property that I have defined in the mainwindow to a 'SelectedDateTime' property in each of the user controls. Ultimately, if I change the SelectedDateTime property in the main window, I want that to propagate down to each of the user controls, which in turn would load data for that date.
I originally just had a normal .NET property that in the Set method, looped through the list of controls and set the SelectedDateTime property in each control.
It works, but I figure there has to be an easier/better way. So I've been trying to look at DependecyProperties/Binding - but trying to figure it out hasn't been to easy.
Any thoughts on the best way to accomplish this in WPF? (Im comfortable in WinForms, but trying to make a switch to WPF)