Reputation: 1235
I have a silverlight chart which has an event when the user clicks on one of the series items.
The even will close the panel which contains the chart and open a new panel with a datagrid of additional data for that series item.
When finished with this data there is a back button which closed the panel with the datagrid and shows the panel with the chart again.
My issue is that when the user is shown the chart it retains the original selected series item. Is there a way to reset this so that the user can reclick on the same item again if they want to.
Upvotes: 0
Views: 678
Reputation: 14037
If you want to clear the selection, you can set the SelectedItem
property to null.
Simple chart for example:
<Button Content="Clear" Click="Button_Click" HorizontalAlignment="Center" />
<chart:Chart x:Name="chart" Grid.Row="1">
<chart:Chart.Series>
<chart:ColumnSeries IsSelectionEnabled="True" ItemsSource="{Binding}" IndependentValuePath="Year" DependentValuePath="Value" />
</chart:Chart.Series>
</chart:Chart>
The code which clears the selection:
private void Button_Click(object sender, RoutedEventArgs e)
{
var cs = (DataPointSeries)this.chart.Series[0];
cs.SelectedItem = null;
}
I use the index 0 because I know the position of the series and it is the first series of the chart.
I think that your chart has single series too.
Upvotes: 1