This question is locked. New answers and comments are not allowed.
Hi there,
I have one page with two charts on it.
Frankly speaking I have also one Grid...
Those two charts are taking 50%/50% width.
They both have a ChartSelectionBehavior that also has a SelectionChanged event handlers.
So, In the demo project I attached I cannot recieve the SelectionChanged events for BAR Chart.
Event handler is not called.
But if I change from Grid.Column="1" to Grid.Column="0" for RadCartesianChart object and from Grid.Column="0" to Grid.Column="1" for RadPieChart respectively.
It works! I am able to recieve all events. Is there something I have missed?
Page xaml:
ViewModel:
Page code behind:
Thanks in advance,
Vladimir.
I have one page with two charts on it.
Frankly speaking I have also one Grid...
Those two charts are taking 50%/50% width.
They both have a ChartSelectionBehavior that also has a SelectionChanged event handlers.
So, In the demo project I attached I cannot recieve the SelectionChanged events for BAR Chart.
Event handler is not called.
But if I change from Grid.Column="1" to Grid.Column="0" for RadCartesianChart object and from Grid.Column="0" to Grid.Column="1" for RadPieChart respectively.
It works! I am able to recieve all events. Is there something I have missed?
Page xaml:
<Page x:Class="App1.MainPage" xmlns:local="using:App1" xmlns:telerik="using:Telerik.UI.Xaml.Controls.Chart" xmlns:charting="using:Telerik.Charting" mc:Ignorable="d"> <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="353*"/> <ColumnDefinition Width="330*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="8*"/> <RowDefinition Height="79*"/> </Grid.RowDefinitions> <telerik:RadCartesianChart HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" PaletteName="DefaultDark" Grid.Row="1" Margin="10"> <telerik:RadCartesianChart.Behaviors> <telerik:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_OnSelectionChanged_BAR"/> </telerik:RadCartesianChart.Behaviors> <telerik:RadCartesianChart.HorizontalAxis> <telerik:CategoricalAxis/> </telerik:RadCartesianChart.HorizontalAxis> <telerik:RadCartesianChart.VerticalAxis> <telerik:LinearAxis/> </telerik:RadCartesianChart.VerticalAxis> <telerik:RadCartesianChart.Grid> <telerik:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y"/> </telerik:RadCartesianChart.Grid> <telerik:BarSeries ItemsSource="{Binding Items}"> <telerik:BarSeries.ValueBinding> <telerik:PropertyNameDataPointBinding PropertyName="Value"/> </telerik:BarSeries.ValueBinding> <telerik:BarSeries.CategoryBinding> <telerik:PropertyNameDataPointBinding PropertyName="Category"/> </telerik:BarSeries.CategoryBinding> </telerik:BarSeries> </telerik:RadCartesianChart> <telerik:RadPieChart Name="pieChart" Grid.Column="0" Grid.Row="1" PaletteName="DefaultDark" Margin="0,0,10,0"> <telerik:RadPieChart.Behaviors> <telerik:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_OnSelectionChanged_PIE" DataPointSelectionMode="Single" SeriesSelectionMode="Single"/> </telerik:RadPieChart.Behaviors> <telerik:PieSeries ItemsSource="{Binding Items}" RadiusFactor="0.5"> <telerik:PieSeries.ValueBinding> <telerik:PropertyNameDataPointBinding PropertyName="Value"/> </telerik:PieSeries.ValueBinding> <telerik:PieSeries.LabelDefinitions> <telerik:ChartSeriesLabelDefinition Margin="-15"/> </telerik:PieSeries.LabelDefinitions> </telerik:PieSeries> </telerik:RadPieChart> </Grid> </Grid></Page>ViewModel:
public class ViewMOdel : INotifyPropertyChanged { private IEnumerable<CategoricalDataPoint> _items; public IEnumerable<CategoricalDataPoint> Items { get { return _items; } set { _items = value; OnPropertyChanged(); } } public ViewMOdel() { var items = new List<CategoricalDataPoint>(); for (int i = 2004; i < 2012; i++) { items.Add(new CategoricalDataPoint { Category = i.ToString(), Value = i%2 == 0 ? 2000 : 0, }); } Items = items; } public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } }Page code behind:
public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); this.DataContext = new ViewMOdel(); } protected override void OnNavigatedTo(NavigationEventArgs e) { } private void ChartSelectionBehavior_OnSelectionChanged_PIE(object sender, EventArgs e) { Debugger.Break(); } private void ChartSelectionBehavior_OnSelectionChanged_BAR(object sender, EventArgs e) { Debugger.Break(); } }Thanks in advance,
Vladimir.