Where can I find out enough info about how Brushes work to implement my own System.Windows.Media.Brush? I can handle all of the freezable baggage, but it’s not really obvious what I need to override to get it to work.
Yeah, so I didn’t mean that I want to use a predefined brush. I want to extend System.Windows.Media.Brush, which is an abstract class. This is all purely for my own edification. I’m not even sure what kind of brush I could make. I was just trying to learn how brushes work. As in:
public AwesomeBrush : Brush
{
protected override Freezable CreateInstanceCore()
{
return new AwesomeBrush();
}
... // concrete brush stuff
}
You cannot make a custom WPF brush by inheriting from the
System.Windows.Media.Brushclass, because that class contains abstract members that are internal.If you use Reflector to view the source code of
System.Windows.Media.Brushclass, you will see the following internal abstract methods:These must be overridden but cannot be because they are internal.
Note: Edited my answer because previous answer was about
System.Drawing.Brushand irrelevant to this question. Special thanks to Mikko Rantanen for his comment.