Hi, I want to create a Resource Library of Drawing Brushes. The Idea is create a base drawing brush and change the color throw a dependency propertie and use the new drawing brush in xaml. (i don´t create a new drawing. the drawing is same but the colors changed)
I can do throw this:
DrawingBrush drwBrush = Mystyles[myDrawing] as DrawingBrush;
drwBrush.SetValue(MyProperties.InternalSolidBrushProperty, Mystyles[keySolidBrush]);
I try this way but dosen´t work :(
<DrawingBrush
x:Key="SymbolLock2"
Stretch="Uniform"
custom:MyProperties.InternalSolidBrush="{StaticResource SolidBrushOver}"
Drawing="{Binding Source={StaticResource SymbolLock},Path=Drawing}"/>
Any Ideas? Dependency propertie InternalSolidBrushProperty dosen´t change the color of base drawing.!!
The code:
// DependencyProperty
public static readonly DependencyProperty InternalSolidBrushProperty;
/
/DrawingBrush
<DrawingBrush x:Key="SymbolLock" Stretch="Uniform"
custom:MyProperties.InternalSolidBrush="{StaticResource
SolidBrushIconMenuSecondary}">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
......
<GeometryDrawing Brush="{Binding
Path=(custom:MyProperties.InternalSolidBrush),
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type
DrawingBrush}}}" Geometry="F1 M 35.0118,21.7446L 33.5068,21.7446L
33.5025,14.4511C 33.4983,6.47188 27.0361,0.00474548
19.0556,-1.52588e-005C 11.071,0.00474548 4.60764,6.47188
4.60335,14.4511L 4.60335,21.7446L 3.09834,21.7446C 1.38731,21.7446
7.62939e-006,23.1342 7.62939e-006,24.8459L 7.62939e-006,42.9929C
7.62939e-006,44.707 1.38731,46.0967 3.09834,46.0967L 35.0118,46.0967C
36.7276,46.0967 38.1155,44.707 38.1155,42.9929L 38.1155,24.8459C
38.1155,23.1342 36.7276,21.7446 35.0118,21.7446 Z M 10.5533,14.4511C
10.5659,9.75938 14.3586,5.96257 19.0556,5.95174C 23.748,5.96257
27.5484,9.75938 27.5532,14.4511L 27.5532,21.7446L 10.5533,21.7446L
10.5533,14.4511 Z "/>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
Best Regards Ricardo Silva