I am trying to bind a value of a slider control to a property that is in the same control:
<Slider
Value="{Binding Path=ValueProperty, RelativeSource={RelativeSource Self}}"
Name="slider1" />
but it doesn't bind to a "ValuePropery"... What am I doing wrong?
I'm not sure what you mean by the same control. If you are creating your user control and it contains a property named ValueProperty that you've defined (i.e. in code behind of the control), you can try the code:
<Slider
Value="{Binding ElementName=LayoutRoot Path=Parent.ValueProperty}"
Name="slider1" />
This solution requires you to have your root control in your user control to be named LayoutRoot
(it's the default).
As I understand you are trying to bind Slider Value property to itself, if that is the case then you inccorectly determining Path of Binding change your XAML as follow:
<Slider Value="{Binding Path=Value, RelativeSource={RelativeSource Self}}"
Name="slider1" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With