Annotations visibility

6 posts, 1 answers
  1. Jean-Pierre
    Jean-Pierre avatar
    6 posts
    Member since:
    Jan 2013

    Posted 10 Jan 2013 Link to this post

    Hi,

    I would like to bind the visibility property of an annotaiton to a property of my DataContext binded to a checkbox.
    It seems that setting the Visibility property of an annotation has no effects.
    Is it a bug ? Do i need to remove it from annotation's collection and reinsert it ?

    Regards.
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 15 Jan 2013 Link to this post

    Hi Jean-Pierre,

    Due to the specifics of the RadChartView, you need to use TwoWay binding for the Visiblity properties of the annotations. I have attached a sample project demonstrating that. In it I directly bind the Visibility of the annotations to the IsChecked property of the CheckBoxes (without having properties in the ViewModel).

    I hope this helps.
     
    Regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jean-Pierre
    Jean-Pierre avatar
    6 posts
    Member since:
    Jan 2013

    Posted 15 Jan 2013 Link to this post

    Hi

    Thanks for the reply and the sample.
    Indeed, it seems to work but there is still an issue;
    Try uncheck all the radiobutton and resize the window.
    All annotations become visible again. At least in my version (2012.3.1017.40)

    Regards
  5. Dana
    Dana avatar
    6 posts
    Member since:
    May 2011

    Posted 17 Jan 2013 Link to this post

    I can confirm that this is indeed the case.
    I had already bound a number of annotations to a checkbox in the manner suggested.

    However, it appears that anything that causes the chart to re-render will make the annotations visible again.
    [window resize, changing the zoom of the chart]

    I can also confirm that setting the visibility of an annotation explicitly in markup to 'Hidden' of 'Collapse' has no effect.
  6. Answer
    Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 18 Jan 2013 Link to this post

    Hi,

    Excuse me for not seeing this earlier.

    I believe that the cause of the problem is that the RadChartView internally sets the visibility of its visual elements in code. If an element is outside of the visible plot area its visibility is set to collapsed, and if it is in range its visibility is set to visible. This occurs when something causes the chart layout to be updated. 

    The solution to this is to use the opacity property, instead of the visibility. I have attached a modified version of the previous project to demonstrate this.

    Regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. Jean-Pierre
    Jean-Pierre avatar
    6 posts
    Member since:
    Jan 2013

    Posted 21 Jan 2013 Link to this post

    That should do the trick !

    Thanks.
Back to Top
UI for WPF is Visual Studio 2017 Ready