The following is some partial XAML:
<CheckBox Content="Display Data Points?" Margin="8,0.04,0,4" Grid.Row="1" FlowDirection="RightToLeft" d:LayoutOverrides="Height" HorizontalAlignment="Left"/>
and
<vf:DataSeries RenderAs="Line" DataSource="{Binding CdTeRoughnessList}" XValueType="DateTime" MarkerEnabled="{Binding ???}" Color="Red" LegendText="Roughness Average">
I would like to bind the MarkerEnabled property of the DataSeries to the IsChecked property of the CheckBox. In other words, when the user checks the check box, I want the MarkerEnabled to be set to True and False when unchecked.
Can this be done (I'm almost sure WPF would support this)? If so, how might I do it?
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.
Element Binding: You can bind UI element to other UI element. <TextBox Name="txt1" Text="{Binding Path=EmpName}" /> <TextBox Name="txt2" Text="{Binding Path= Text, ElementName=txt1}" />
In One Way binding, source control updates the target control, which means if you change the value of the source control, it will update the value of the target control. So, in our example, if we change the value of the slider control, it will update the textbox value, as shown below.
Give your Checkbox a name and then bind appropriately:
<CheckBox x:Name="DisplayDataCheckbox" Content="Display Data Points?"/> <vf:DataSeries MarkerEnabled="{Binding ElementName=DisplayDataCheckbox, Path=IsChecked}">
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