This is a migrated thread and some comments may be shown as answers.

hide/show panzoombar smartly

2 Answers 85 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
jzhou
Top achievements
Rank 1
jzhou asked on 13 Jul 2015, 06:19 AM

Hello,

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?

 

Thanks,

Jie

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 15 Jul 2015, 08:37 AM
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.

Regards,
Martin
Telerik
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
0
jzhou
Top achievements
Rank 1
answered on 27 Aug 2015, 05:49 AM

hello,

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

 Thanks

Tags
ChartView
Asked by
jzhou
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
jzhou
Top achievements
Rank 1
Share this question
or