SelectedPoints on a Bar Chart

3 posts, 0 answers
  1. Paul
    Paul avatar
    38 posts
    Member since:
    Feb 2014

    Posted 20 Feb 2014 Link to this post

    I am sure I am missing something, but I am not seeing any updates to my ViewModel for any selection changes.  I am getting the SelectionChanged Event in my code behind (which I don't want, I put it there for testing), but nothing through the binding. When I breakpoint on the event, and I look at the chart, the SelectedPoints property has the proper points in it.  Relevant things shown below.

    <telerik:RadCartesianChart x:Name="chart" Palette="Autumn" SelectedPoints="{Binding SelectedDataPoints, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

        <chartView:BarSeries ItemsSource="{Binding rgs}" PaletteMode="DataPoint" IsHitTestVisible="True" CategoryBinding="Name"
                 <Rectangle Fill="{Binding Converter={StaticResource GoodToBad}}" />

         <telerik:ChartSelectionBehavior DataPointSelectionMode="Single" SelectionChanged="ChartSelectionBehavior_SelectionChanged" />

    and in my view model:

    private ReadOnlyDataPointCollection _dataPoints = null;
    public ReadOnlyDataPointCollection SelectedDataPoints
        get { return _dataPoints; }
           _dataPoints = value;
           RaisePropertyChanged(() => SelectedDataPoints);

    There are no binding errors showing in the output window, and the "get" property on the SelectedDataPoints property in my view model is getting hit.  But never the set.

    What am I missing?


  2. Petar Mladenov
    Petar Mladenov avatar
    2985 posts

    Posted 25 Feb 2014 Link to this post

    Hello Paul,

    I didn't managed to reproduce the same issue. So I attached the sample project in which i tried to reproduce what you describe. In order to track when you set the SelectedDataPoints property you can checkout the Output window of the Visual Studio. 

    If you want to track when the changes occur it might be a better idea to implement the EventToCommand pattern.

    Please let us know if this helps.

    Petar Mladenov
  3. Paul
    Paul avatar
    38 posts
    Member since:
    Feb 2014

    Posted 26 Feb 2014 in reply to Petar Mladenov Link to this post

    Thank you for the follow up.  I will check out your sample.  Like I said, I am sure it is something stupid I am missing.

Back to Top