Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
Dynamically show/hide ZoomBar
posted

I am trying to dynamically show/hide the ZoomBar based on a flag in code.

I tried this in code-behind:

XamZoombar zoom = this.xamTimeline.Zoombar; 
if (zoom != null)
{
      if (zoom.Visibility == System.Windows.Visibility.Visible)
      {
          zoom.Visibility = System.Windows.Visibility.Collapsed;
      }
      else
      {
          zoom.Visibility = System.Windows.Visibility.Visible;
      }
}

 

That works, however then I have a white space at the bottom where the zoombar used to be shown. The "content" portion of the TimeLine control does not resize itself to fill out the space.

I also found this post on setting the style: http://forums.infragistics.com/forums/p/22933/84022.aspx#84022

So I tried this:

if (blnHide == true)
{
   var newStyle = this.Resources["ZoombarStyleHidden"as Style;
   this.xamTimeline.ZoombarStyle = newStyle;
}
else
{
   var newStyle = this.Resources["ZoombarStyleNormal"as Style;
   this.xamTimeline.ZoombarStyle = newStyle;
}

This works to hide the ZoomBar, but then I never can get it to show again, it remains hidden even if I set the style to ZoombarStyleNormal. Here are the style definitions:

        <Style x:Key="ZoombarStyleHidden"
               TargetType="ig:XamZoombar">
            <Setter Property="Visibility"
                    Value="Collapsed" />
        </Style>
        <Style x:Key="ZoombarStyleNormal"
               TargetType="ig:XamZoombar">
            <Setter Property="Visibility"
                    Value="Visible" />
        </Style>

Any suggestions what I am doing wrong? Do I need to define the "full" style for the ZoombarStyleNormal as given here: http://forums.infragistics.com/forums/t/32065.aspx  I would rather not have this big style in my XAML and just reset the Zoombar to using it's default style.

Thank you,

Mike