It's okay. It's hard to remember and easy to forget,
<Window X: class = "desktopui. Shape and transformation and painting brush. Painting Brush"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Title = "paint brush" Height = "500" width = "900">
<Window. Resources>
<Style targettype = "{X: Type textblock}" X: Key = "stytextblock">
<Style. setters>
<Setter property = "fontsize" value = "15"/>
</Style. setters>
</Style>
<Style targettype = "{X: Type textblock}" basedon = "{staticresource resourcekey = stytextblock}" X: Key = "DESC">
<Setter property = "margin" value = "5"/>
<Style. triggers>
<Trigger property = "ismouseover" value = "true">
<Setter property = "foreground" value = "red"/>
</Trigger>
</Style. triggers>
</Style>
</Window. Resources>
<Grid>
<Grid. rowdefinitions>
<Rowdefinition Height = "180" type = "regxph" text = "yourobjectname"/>
<Rowdefinition Height = "*"/>
<Rowdefinition Height = "*"/>
</Grid. rowdefinitions>
<Grid. columndefinitions>
<Columndefinition width = "200" type = "codeph" text = "/codeph"/>
<Columndefinition width = "*"/>
</Grid. columndefinitions>
<! -- Visualbrush -->
<Stackpanel grid. Row = "0" grid. Column = "0" orientation = "vertical">
<Textblock text = "visualbrush painter" style = "{staticresource resourcekey = stytextblock}"/>
<Rectangle stroke = "black" Height = "150" width = "180">
<Rectangle. Fill>
<Visualbrush>
<Visualbrush. Visual>
<Stackpanel background = "white">
<Rectangle width = "25" Height = "25" fill = "red" margin = "2"/>
<Textblock text = "Hello WPF" fontsize = "10pt" margin = "2"/>
<Button margin = "2" content = "button unavailable"/>
</Stackpanel>
</Visualbrush. Visual>
</Visualbrush>
</Rectangle. Fill>
</Rectangle>
</Stackpanel>
<Stackpanel grid. Row = "0" grid. Column = "1" orientation = "vertical">
<Textblock textwrapping = "Wrap" style = "{staticresource resourcekey = DESC}">
Visurl brush allows developers to obtain an "element content" to fill the image. For example, a form and a control can be used to fill the fill attribute,
However, the filled control is not available. It just copies and can only be viewed as an image ....
The left side can also be written as follows:
</Textblock>
<Button name = "btn1" margin = "3" content = "Copy button"/>
<Rectangle margin = "3" Height = "60">
<Rectangle. Fill>
<Visualbrush visual = "{binding elementname = btn1}"/>
</Rectangle. Fill>
</Rectangle>
</Stackpanel>
<! -- Imagebrush image painter -->
<Stackpanel grid. Row = "1" grid. Column = "0">
<Rectangle width = "200" Height = "100" strokethickness = "1" stroke = "black">
<Rectangle. Fill>
<Imagebrush viewport = "0.3, 0.5," imagesource = "../images/qq.gif" tilemode = "flipy"/>
</Rectangle. Fill>
</Rectangle>
</Stackpanel>
<! -- Concave and convex effect -->
<Stackpanel orientation = "vertical" grid. Row = "1" grid. Column = "1">
<Button width = "200" Height = "50" fontsize = "18" content = "Concave and convex effects">
<Button. bitmapeffect>
<Bevelbitmapeffect bevelwidth = "1" edgeprofile = "curvedout" lightangle = "0" relief = "0.1" smoothness = "0.1"/>
</Button. bitmapeffect>
</Button>
<Image Source = "../images/qq.gif" width = "60" Height = "60" margin = "6">
<Image. bitmapeffect>
<Bevelbitmapeffect bevelwidth = "1" edgeprofile = "curvedout" lightangle = "135" relief = "0.3" smoothness = "0.4"/>
</Image. bitmapeffect>
</Image>
<Textblock text = "bevelwidth: Specifies the width of the slope"/>
</Stackpanel>
<! -- Embossed effect -->
<Stackpanel grid. Row = "2" grid. Column = "0">
<Image Source = "../images/qq.gif" width = "60" Height = "60">
<Image. bitmapeffect>
<Embossbitmapeffect relief = "0.2" lightangle = "320"/>
</Image. bitmapeffect>
</Image>
</Stackpanel>
<! -- Glow and shadow -->
<Stackpanel grid. Row = "2" grid. Column = "1">
<Textblock text = "Luminous outerglowbitmapeffect, shadow dropshadowbitmapeffect:" margin = "3" padding = "3" style = "{staticresource resourcekey = stytextblock}"/>
<Textblock textwrapping = "Wrap" style = "{staticresource resourcekey = DESC}">
Outerglowbitmapeffect => glowcolor: Halo light color; glowsize: Halo thickness; noise: Halo noise level (0 ~ 1 );
<Textblock. bitmapeffect>
<Outerglowbitmapeffect glowcolor = "red" glowsize = "20" noise = "0.5" opacity = "0.4"/>
</Textblock. bitmapeffect>
</Textblock>
<Textblock textwrapping = "Wrap" margin = "20">
Dropshadowbitmapeffect => color: shadow color; ction: Shadow angle; noise: Shadow noise level (0 ~ 1); shadowdepth: the distance between the projection plane and the shadow plane; softness: Specifies the softness of the shadow.
<Textblock. bitmapeffect>
<Dropshadowbitmapeffect color = "black" ction = "20" shadowdepth = "20" softness = "0.3" opacity = "0.4"/>
</Textblock. bitmapeffect>
</Textblock>
</Stackpanel>
</GRID>
</WINDOW>