Is WPF Decorator class useful?
Posted
by darja
on Stack Overflow
See other posts from Stack Overflow
or by darja
Published on 2010-03-27T14:57:21Z
Indexed on
2010/03/27
15:03 UTC
Read the original article
Hit count: 403
I need to create control to draw border around its child. So, I have created class and derived it from Decorator:
class RoundedBoxDecorator : Decorator
{
protected override Size ArrangeOverride(Size arrangeSize)
{
//some source
}
protected override void OnRender(DrawingContext dc)
{
//some source
}
}
It works fine, but I have some doubts about using Decorator as ancestor. I have found in MSDN that there are no special methods or properties in it, only derived from its ancestors (UIElement or FrameworkElement). ArrangeOverride and OnRender are also derived.
So, what for Decorator class was designed and does it makes sense to use it? Or I can derive from FrameworkElement?
© Stack Overflow or respective owner