|
|
Questions and answers for Controls Slider.
|
76. Controls Slider
|
| 76.1 How can I customize
the Ticks on a Slider ?
|
| 76.2 Can I bind two
sliders in two different windows ?
|
76.1 How can I customize the Ticks on a Slider ?
|
|
The ticks on the slider can be customized using the code given below.
|
[XAML]
<Slider Width="100" Value="50" Orientation="Horizontal"
HorizontalAlignment="Left"
IsSnapToTickEnabled="True" Maximum="3"
TickPlacement="BottomRight"
AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="2"
Ticks="0, 1.1, 2.5, 3"/>
|
76.2 Can I bind two sliders in two different windows ?
|
|
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>
|
|