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
1385
Change ContentPane BorderThickness when it's floating
posted

I have a ContentPane which I set the BorderThickness to 0 for because of the styling (the border in the middle of whitespace looks bad).  However, when the pane is in a floating window (undocked), I would like the border back so you can see the edge over the rest of the app.  I thought to make a style trigger, but I can't find an appropriate property to use.

Is there a way I can make this happen?

  • 1385
    Verified Answer
    Offline posted

    I was able to achieve what I wanted with this behavior:

    internal class PaneToolWindowBorderBehavior : Behavior<ContentPane>
    {
    #region Event Handlers
    protected override void OnAttached ()
    {
    base.OnAttached();

    base.AssociatedObject.MouseEnter += MouseEnter;
    base.AssociatedObject.DragEnter += MouseEnter;
    }

    protected override void OnDetaching ()
    {
    base.OnDetaching();

    base.AssociatedObject.MouseEnter -= MouseEnter;
    base.AssociatedObject.DragEnter -= MouseEnter;
    }

    private void MouseEnter (object sender, RoutedEventArgs e)
    {
    if (!(Utilities.GetAncestorFromType(base.AssociatedObject as DependencyObject, typeof(PaneToolWindow), true) is null))
    {
    base.AssociatedObject.BorderThickness = new Thickness(1.0);
    }
    else
    {
    base.AssociatedObject.BorderThickness = new Thickness(0.0);
    }
    }
    #endregion
    }

  • 29085
    Offline posted

    Hi Walter, 

    The panes will need to be retemplated. The border is provided by the PaneToolWindow. You can retemplate that element to change its look. The default styles folder for the WPF controls are located at your installed location. It defaults here:

    C:\Program Files\Infragistics\NetAdvantage 20xx.x\WPF\DefaultStyles\

    Let me know if you have any questions.