Im drawing a ContextMenuwith a slider inside.
This is my actual code:
<MenuItem x:Name="menuSliderOpacity" Header="Opacidade" Width="100">
<MenuItem.Template>
<ControlTemplate TargetType="{x:Type MenuItem}">
<Slider Width="100"
Name="sliderOpacity"
Minimum="0"
Maximum="1"
TickFrequency="0.1"
IsSnapToTickEnabled="True"
ValueChanged="Slider_ChangeOpacity"
Value="{Binding ElementName=btnBackground, Path=Opacity, Mode=TwoWay}"/>
</ControlTemplate>
</MenuItem.Template>
</MenuItem>
For now that is my informations inside it. This slider will control the opacity of background of something on screen, like a button, for example. First I tried:
On the button
{Binding ElementName=sliderOpacity, Path=Value}
Or something like my Value on Slider with two way mode. How can I make that association? And after how could I get or set the value of slider on codebehind.
What is the correct way?