31

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?

ASh
  • 34,632
  • 9
  • 60
  • 82
Hosea146
  • 7,412
  • 21
  • 60
  • 81
  • [`ElementName`](http://msdn.microsoft.com/en-us/library/system.windows.data.binding.elementname.aspx)? – H.B. Feb 02 '12 at 19:58
  • 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 Feb 02 '12 at 20:07

1 Answers1

73

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}">
The Real Baumann
  • 1,941
  • 1
  • 14
  • 20