Use VisualBrush to paint background : VisualBrush « Windows Presentation Foundation « C# / C Sharp






Use VisualBrush to paint background

Use VisualBrush to paint background
     

<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>
        <StackPanel.Background>
            <VisualBrush Opacity="0.1" Viewport="0,0,250,30" ViewportUnits="Absolute" TileMode="Tile" Stretch="None">
                <VisualBrush.Visual>
                    <Border Width="250" Background="Transparent">
                        <TextBlock Margin="5" FontSize="60px" >
              VisualBrush
              <TextBlock.Foreground>
                <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                  <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0.0" Color="Black" />
                    <GradientStop Offset="1.0" Color="Red" />
                  </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
              </TextBlock.Foreground>
                        </TextBlock>
                    </Border>
                </VisualBrush.Visual>
                <VisualBrush.RelativeTransform>
                    <RotateTransform Angle="0" CenterX="0.5" CenterY="0.5" />
                </VisualBrush.RelativeTransform>
            </VisualBrush>
        </StackPanel.Background>
    </StackPanel>
</Page>

   
    
    
    
    
  








Related examples in the same category

1.Tiled VisualBrushTiled VisualBrush
2.VisualBrush and DrawingBrushVisualBrush and DrawingBrush
3.Simulating a reflection with VisualBrushSimulating a reflection with VisualBrush
4.Visual Brush For a RectangleVisual Brush For a Rectangle
5.Tile VisualBrushTile VisualBrush
6.VisualBrush Binding to a ButtonVisualBrush Binding to a Button