29
votes

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?

1
Name the CheckBox and refer to it via ElelmentName like H.B. said with the Path = IsChecked. You may need to use a converted as IsChecked might be bool?.paparazzo

1 Answers

69
votes

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}">