Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had a quick look at the existing brushes using the <a href="http://www.red-gate.com/products/reflector/" rel="noreferrer">Reflector</a>. It seems like their implementation is pretty closed up and depends on lots of <code>internal</code> plumbing. While it might be possible to implement your own brush it seems like it is not a supported option. It could even be that the WPF controls are tied tightly to the existing brushes and will not work with a custom one.</p> <p>Most likely the best way to achieve something resembling custom brushes is to use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.drawingbrush.aspx" rel="noreferrer">DrawingBrush</a> with some complex drawing logic. You can compose drawing brush from complex shapes using other brushes so this should let you achieve the required goal.</p> <p><strong>Update after edit</strong></p> <p>As this is for education, you might be best off downloading the Reflector and using that to see how the brushes work. They are not meant to be self-implemented and since they rely on some <code>internal</code> classes to which programmers do not have access normally it will be quite hard to do so.</p> <p>Though what makes it interesting is that the <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.brush.aspx" rel="noreferrer">Brush documentation</a> does have a remark for inheritors to guide in the correct way to inherit from the Brush.</p> <p><strong>More updates</strong></p> <p>When poking around I found a quite neat way to achieve something similar on a <a href="http://translate.google.com/translate?prev=hp&amp;hl=fi&amp;js=n&amp;u=http%3A%2F%2Fblog.csdn.net%2Fxeonol%2Farchive%2F2007%2F12%2F17%2F1943067.aspx&amp;sl=zh-CN&amp;tl=en" rel="noreferrer">chinese blog</a>. The trick there is to use a markup extension so it just looks like a brush. In reality it creates a new image brush based on its attributes. Seems he came to the same conclusion that there are some internal classes which prevent the easy implementation.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload