drawingbrush not found in visual studio 2010/2012

271 Views Asked by At

I have to mention first that I have never worked with silverlight before. I'm currently starting a project and I need to work with DrawingBrush... to resolve this task I'm developing in visual studio 2012 and sometimes in 2010, the project is Silverlight5 This is the context where I need DrawingBrush

<Image Source="Images/image.png">
            <Image.OpacityMask>
                <DrawingBrush>
                    ...
                </DrawingBrush>
            </Image.OpacityMask>
 </Image>

The problem is I can't find use DrawingBrush... it doesn't find it's reference. Intellisense says: "The type or namespace name 'DrawingBrush' does not exist in the namespace 'System.Windows.Media' (are you missing an assembly reference?)"

Do I have to include something or add a certain reference to my project to use DrawingBrush? Thanks!

1

There are 1 best solutions below

0
On

I suggest you to do it in different way.

Convert this image into WriteableBitmap (pixel information) as WB1. Take another WriteableBitmap as WB2 of same size field with Black color pixel.

Render WB2 as image. Now whenever required you can copy specific pixels from WB1 to WB2 and display the modified WB2.

The following project/sample code will help you to learn to work with WritableBitmap. You just need to learn the following things from this project.

  1. How to read pixel information from an image.
  2. How to modify those pixels information
  3. and how to display the modified pixels information as Image

Sample Code: http://code.msdn.microsoft.com/CSSL3WriteableBitmap-960deef6

This project supports Silverlight 3. So definitely it will be supported in Silverlight 5.

Hope this helps!