Mega Code Archive

 
Categories / VB.Net / WPF
 

Use Rectangle, TextBlock and Button as the VisualBrush

<Page     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    x:Class="Microsoft.Samples.Graphics.UsingVisualBrush.PaintingWithVisuals">     <StackPanel>         <Rectangle Width="150" Height="150" Stroke="Black" Margin="0,0,5,0">             <Rectangle.Fill>                 <VisualBrush Viewport="0,0,50,50" ViewportUnits="Absolute" TileMode="Tile">                     <VisualBrush.Visual>                         <StackPanel Background="Transparent">                             <Rectangle Width="25" Height="25" Fill="Red" Margin="2" />                             <TextBlock FontSize="10pt" Margin="2">Hello, World!</TextBlock>                             <Button Margin="2">A Button</Button>                         </StackPanel>                     </VisualBrush.Visual>                 </VisualBrush>             </Rectangle.Fill>         </Rectangle>     </StackPanel> </Page>