Issue with child of custom Decorator class in WPF (c#)

Posted by galacticgrug on Stack Overflow See other posts from Stack Overflow or by galacticgrug
Published on 2010-05-30T18:48:43Z Indexed on 2010/05/30 18:52 UTC
Read the original article Hit count: 284

Filed under:
|
|
|

I need a custom border that renders a little differently than a normal border. I made a class that inherited from Decorator as follows

class BetterBorder : Decorator
{
    protected override Size ArrangeOverride(Size arrangeSize)
    {
        return arrangeSize;
    }

    protected override void OnRender(DrawingContext dc)
    {
        //these values are calculated elsewhere
        dc.DrawGeometry(backgroundBrush, borderPen, pathGeometry);
    }
}
//Properties and helper methods below this

All of this works fine until I try to add a child to the control, the control can be added but is not visible and seems to be moved off BetterBorders visible client area. If I inherit from Border everything works fine, what am I missing?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET