jeudi 13 juin 2019

How can I WPF bind dynamically created checkboxes to dynamically created series in LiveCharts?

I have a liveChart and am creating checkboxes for each item in a list. This list also has data for each series in liveCharts. How do I bind my dynamically created checkboxes with each individual LiveCharts.LineSeries from my data?

I've created the checkboxes:

<!-- Creating checkboxes by binding to list -->
<ListView ItemsSource="{Binding ElementItemList}" 
ScrollViewer.HorizontalScrollBarVisibility="Disabled" Width="600">
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Path=ElementName}" />
                        <CheckBox IsChecked="{Binding Path=ElementIsSelected}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListView>

<!-- Display the chart -->
<Grid Grid.Row="1" x:Name="TestGrid"></Grid>




Aucun commentaire:

Enregistrer un commentaire