views:

54

answers:

2

I can do element-to-element binding in WPF: For example, I've got a window that has a slider control and a textbox, and the textbox dynamically displays the Value property of the slider as the user moves the slider.

But how do i do this across seperate windows (in the same project, same namespace) ?

The reason is that my main application window containing the textbox has a menu option that will open an 'options' window containing the slider control.

Thanks.

A: 

You dont. Point. Databinding has to go to an element accessible in the same control.

What you can do is have the options menu bind go an object that it has in it's own code (property) that gets populated to the same object the othe rwindow uses as data source.

TomTom
+2  A: 

You should use a (global) ViewModel, containing the data you need to share, and bind to the property from that ViewModel.

This way the changes in either of windows are reflected in the bound data object, and back.

Vlad