VisualBrush Binding to a Button : VisualBrush « Windows Presentation Foundation « C# / C Sharp






VisualBrush Binding to a Button

VisualBrush Binding to a Button
     
<Window x:Class="Drawing.VisualBrush"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="VisualBrush" Height="300" Width="300"
    >
  <StackPanel Margin="3">
    <Button Name="cmd" Margin="3" Padding="5">Is this a real button?</Button>
    <Rectangle Margin="3" Height="{Binding ElementName=cmd,Path=ActualHeight}">
      <Rectangle.Fill>
        <VisualBrush Visual="{Binding ElementName=cmd}"></VisualBrush>
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Margin="3" Height="50">
      <Rectangle.Fill>
        <VisualBrush Visual="{Binding ElementName=cmd}"></VisualBrush>
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Margin="3" Height="150">
      <Rectangle.Fill>
        <VisualBrush Visual="{Binding ElementName=cmd}"></VisualBrush>
      </Rectangle.Fill>
    </Rectangle>
  </StackPanel>
</Window>

   
    
    
    
    
  








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.Use VisualBrush to paint backgroundUse VisualBrush to paint background
6.Tile VisualBrushTile VisualBrush