One qestion about yellow text on top of a graduated fill background, using this mask to modulate

Dear all,

I had one question about implementing the following scenario. i.e. yellow text on top of a graduated fill background, using this mask to modulate the opacity. The ideal outlook will be like figure 2 on thiswebsite.

I try to do like this in the window1.xaml.

<TextBlock DockPanel.Dock="Top" FontSize="36" Foreground="Red" Style ="{StaticResource LineGra_Textblock}">
Text....
</TextBlock>
<DrawingBrush Viewbox="0,0,1,1" ViewboxUnits="Absolute"
Viewport="0,0,0.07,0.2" TileMode="Tile">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="HorizontalGradient #f000 #0000">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,1,0.6" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>

However, it is said that there is no DrawingBrush. I created the WFP application with the references added in default, shall I miss to add something else?

And I think that I have to set DrawingBrush inside tag <TextBlock>. Is it right?

Thanks in advance,

[1442 byte] By [LuisinSE] at [2008-2-15]
# 1

Are you trying to create this in WPF or WPF/E?

WPF/E is a subset of WPF and doesn't have a DrawingBrush (Or DockPanels, or Styles) so the above code won't work with WPF/E. At least not with the current CTP.

BryantLikes at 2007-9-5 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Designer Issues...
# 2
Hey Bryant,

I am playing with WPF...

Bryant Likes wrote:

Are you trying to create this in WPF or WPF/E?

WPF/E is a subset of WPF and doesn't have a DrawingBrush (Or DockPanels, or Styles) so the above code won't work with WPF/E. At least not with the current CTP.

LuisinSE at 2007-9-5 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Designer Issues...
# 3

You would probably have better luck over in the WPF Forums. However, I think in this case you just need to set the brush to be the TextBlock.Foreground like this:

<TextBlock DockPanel.Dock="Top" FontSize="36" Foreground="Red" Style ="{StaticResource LineGra_Textblock}">

<TextBlock.Foreground>
<DrawingBrush Viewbox="0,0,1,1" ViewboxUnits="Absolute"
Viewport="0,0,0.07,0.2" TileMode="Tile">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="HorizontalGradient #f000 #0000">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,1,0.6" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>

</TextBlock.Foreground>
Text....
</TextBlock>

If that doesn't work then you might want to try the WPF forums.

BryantLikes at 2007-9-5 > top of Msdn Tech,Silverlight (formerly WPF/E),Silverlight (formerly WPF/E) Designer Issues...