hide/show panzoombar smartly

3 posts, 1 answers
  1. jzhou
    jzhou avatar
    7 posts
    Member since:
    Jul 2015

    Posted 13 Jul 2015 Link to this post


    I want to show the panzoombar when the user zoom the chart, and hide the panzoombar if there is no zoom. So I implement this:

    I add tiggers in the a style for panzoombar:

     <Style.Triggers><br>                <Trigger Property="Orientation" Value="Horizontal"><br>                    <Setter Property="Visibility" Value="{Binding HorizontalPanZoomBarVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/><br>                </Trigger><br>                <Trigger Property="Orientation" Value="Vertical"><br>                    <Setter Property="Visibility" Value="{Binding VerticalPanZoomBarVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/><br>                </Trigger><br>            </Style.Triggers>

    In the view model:

       private Size _zoom = new Size(1, 1);<br>       public Size Zoom<br>      {<br>         get { return _zoom; }<br>           set<br>         {<br>               _zoom = value;<br>                if (Math.Abs(_zoom.Width - 1) < 0.00001f)<br>                {<br>                    HorizontalPanZoomBarVisible = false;<br>                }<br>                else<br>                {<br>                    HorizontalPanZoomBarVisible = true;<br>                }<br><br>                if (Math.Abs(_zoom.Height - 1) < 0.00001f)<br>                {<br>                    VerticalPanZoomBarVisible = false;<br>                }<br>                else<br>                {<br>                    VerticalPanZoomBarVisible = true;<br>                }<br>         }<br>       }<br><br>     public bool VerticalPanZoomBarVisible<br>     {<br>         get<br>            {<br>              return _verticalPanZoomBarVisible;<br>            }<br>           set<br>            {<br>              _verticalPanZoomBarVisible = value;<br>                RaisePropertyChanged(() => VerticalPanZoomBarVisible);<br>          }<br>       }<br><br>     private bool _horizontalPanZoomBarVisible;<br>        private bool _verticalPanZoomBarVisible;<br><br>      public bool HorizontalPanZoomBarVisible<br>       {<br>         get { return _horizontalPanZoomBarVisible; }<br>            set<br>         {<br>               _horizontalPanZoomBarVisible = value;<br>                RaisePropertyChanged(() => HorizontalPanZoomBarVisible);<br>          }<br>       }

    The chart:

     <telerik:RadCartesianChart Grid.Row="2" x:Name="Chart" Margin="20" Zoom="{Binding Zoom, Mode=TwoWay}">


    The problem is, it work only for the first time, at the beginning, there is no zoom, so the panzoombar hides correctly, after I zoom, the panzoombar appear correctly, but if I reset zoom to (1,1), and zoom again, the panzoombar never appear, I don't know why? I use snoop to check and find out the visibility of the panzoombar is changed correctly, but I still can not see it.

     Do you have any ideas?




  2. Answer
    Martin Ivanov
    Martin Ivanov avatar
    1444 posts

    Posted 15 Jul 2015 Link to this post

    Hi Jie,

    I was not able to reproduce the issue with our latest release - your implementation works as expected. We had an issue with the changing the Visibility of the chart's PanZoomBars which is already fixed in our latest official release. Please test the new dlls and let me know if the issue still occurs.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. jzhou
    jzhou avatar
    7 posts
    Member since:
    Jul 2015

    Posted 27 Aug 2015 in reply to Martin Ivanov Link to this post


    I have tested the new dll, and the issue is resolved.


Back to Top