Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: AvalongDock - LayoutDocumentPane - IsVisible binding

$
0
0
The Visibility of the LayoutDocumentPane is evaluated in its method "GetVisibility()".

This means you can use this method to return True or False weather you want to show or hide the LayoutDocumentPane.
You could maybe add a bool DependencyProperty in the new MyLayoutDocumentPane class which would be bound as you did. On the propertyChanged, force a VisibilityRefresh. Then, use GetVisibility() method like this :
protected override bool GetVisibility()
    {
      return this.MyBool;
    }
The complete MyLayoutDocumentPane class :
 public class MyLayoutDocumentPane : Xceed.Wpf.AvalonDock.Layout.LayoutDocumentPane
  {
    #region MyBool

    public static readonly DependencyProperty MyBoolProperty = DependencyProperty.Register( "MyBool", typeof( bool ), typeof( MyLayoutDocumentPane ),
      new UIPropertyMetadata( true, OnMyBoolChanged ) );
    public bool MyBool
    {
      get
      {
        return (bool)GetValue( MyLayoutDocumentPane.MyBoolProperty );
      }
      set
      {
        SetValue( MyLayoutDocumentPane.MyBoolProperty, value );
      }
    }

    private static void OnMyBoolChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
    {
      ((MyLayoutDocumentPane)d).OnMyBoolChanged( (bool)e.OldValue, (bool)e.NewValue );
    }

    protected virtual void OnMyBoolChanged( bool oldValue, bool newValue )
    {
      this.ComputeVisibility();
    }

    #endregion //MyBool

    protected override bool GetVisibility()
    {
      return this.MyBool;
    }
  }

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>