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

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?

  • 1210
    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.AssociatedObject.MouseEnter += MouseEnter;
    base.AssociatedObject.DragEnter += MouseEnter;

    protected override void 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);
    base.AssociatedObject.BorderThickness = new Thickness(0.0);

Reply Children
No Data