I can bind a label to a slider as shown below:
<Label Name="lblTest" Content="{Binding ElementName=slider1, Path=Value}"/>
How do I bind another label to the same slider with display value of, say, 30% of the value of slider? How do I do the calculation in xaml and not in my code? Thanks.
Data binding is a mechanism in XAML applications that provides a simple and easy way for Windows Runtime Apps using partial classes to display and interact with data. The management of data is entirely separated from the way the data is displayed in this mechanism.
Data binding is a mechanism in WPF applications that provides a simple and easy way for Windows Runtime apps to display and interact with data. In this mechanism, the management of data is entirely separated from the way data. Data binding allows the flow of data between UI elements and data object on user interface.
Two way binding is used when we want to update some controls property when some other related controls property change and when source property change the actual control also updates its property.
You cannot do the calculation in XAML, you could however apply some converter which does it for you.
This question might be relevant: How do you change a bound value, reverse it, multiply it, subtract from it or add to it?
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