I have a radchart on a wpf app. the data series are dynamically given to the xaml file to display. it can chart 1 to 4 lines at a time. We want to create some toggles on the screen that will turn on/off viislibty PEr line and on/off data labels per line.
i did some research on how to programmatically set binding and it only partially works. my converter fires from the toggle, but the dependency property does not. here are the key pieces of code:
codebehind:
Format Code Block
var seriesMapping = new SeriesMapping();
var seriesDefinition = new LineSeriesDefinition();
seriesMapping.SeriesDefinition = seriesDefinition;
var binding = new Binding(){ Path= new PropertyPath("IsChecked"), Converter = new BooleanToVisibilityConverter(), Source = toggleVisible1, Mode = BindingMode.OneWay};
BindingOperations.SetBinding(seriesDefinition, SeriesDefinition.VisibilityProperty, binding);
Format Code Block
XAML
<CheckBox x:Name="toggleVisible1" Content="Show Line" HorizontalAlignment="Right" Margin="5,2,15,2" FlowDirection="RightToLeft" IsChecked="True" />
converter code - for the most part boils down to this:
return (value? Visibility.Visible : Visibility.Collapsed);
Again, the converter fires when the checkbox is toggle, but the series always stays visible. what am i doing wrong?
i am using latest version of wpf controls.