Can I bind two sliders in two different windows ?

Platform: WPF| Category: Slider

You can bind two sliders, one on each of two windows and both of them linked to the same data. But they both have to be bound to the same instance of your data.

[C#]

yourDataType yourDataInstance = new YourDataType();
yourWindow1Instance.DataContext = yourDataInstance;
yourWindow2Instance.DataContext= yourDataInstance;

[XAML]

        <Window1>
           <Slider Value='{Binding ValueProperty}' />
        </Window1>
        <Window2>
            <Slider Value='{Binding ValueProperty}' />
        </Window2>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.