Default Button

image_pdfimage_print


   
      
<Window x:Class="SimpleStyles.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="SimpleStyles"
  Background="#F8F8F8">
  <ScrollViewer>
    <WrapPanel>
      <HeaderedItemsControl Header="Button">
        <Button Margin="8" IsDefault="True">Default</Button>
        <Button Margin="8">Normal</Button>
      </HeaderedItemsControl>

    </WrapPanel>
  </ScrollViewer>
</Window>

   
    
    
    
    
    
     


Button with Image source

image_pdfimage_print


   
      

<Window x:Class="OpacityMaskExample"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title=""
  Height="430" Width="300">
  <Grid>
       <Button Name="Select" ToolTip="Select" Margin="5" Width="60" Height="60" Background="LightCoral">
          <Image Width="50" Height="50">
            <Image.Source>
              <DrawingImage>
                <DrawingImage.Drawing>
                  <GeometryDrawing Brush="Yellow">
                    <GeometryDrawing.Geometry>
                      <PathGeometry
                        Figures="M25,75 L 50,0 200,75 100,75 60,100 40,100,40,75Z">
                        <PathGeometry.Transform>
                          <RotateTransform
                            CenterX="50" CenterY="50" Angle="45" />
                        </PathGeometry.Transform>
                      </PathGeometry>
                    </GeometryDrawing.Geometry>
                    <GeometryDrawing.Pen>
                      <Pen Brush="Gray"
                        Thickness="3" />
                    </GeometryDrawing.Pen>
                  </GeometryDrawing>
                </DrawingImage.Drawing>
              </DrawingImage>
            </Image.Source>
          </Image>
        </Button>
  </Grid>
</Window>

   
    
    
    
    
    
     


Button with OpacityMask

image_pdfimage_print


   
      

<Window x:Class="OpacityMaskExample"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title=""
  Height="430" Width="300">
  <Grid>
        <Button Height="60" Width="60"
          RenderTransformOrigin="1,0.5">
          <Button.OpacityMask>
            <LinearGradientBrush StartPoint="0,0"
              EndPoint="0,1">
              <GradientStop Color="Transparent"
                Offset="0" />
              <GradientStop Color="#77000000" Offset="1" />
            </LinearGradientBrush>
          </Button.OpacityMask>
          <Button.RenderTransform>
            <ScaleTransform ScaleY="-1" />
          </Button.RenderTransform>
        </Button>
  </Grid>
</Window>

   
    
    
    
    
    
     


The button and text block are up-side down in the custom coordinate system.

image_pdfimage_print


   
      
<Window x:Class="LineInCustomSystem"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Line In Custom System" Height="240" Width="220">
  <Border BorderBrush="Black" BorderThickness="1" Height="200"
    Width="200">
    <Canvas Height="200" Width="200">
            <Button Canvas.Top="50" Canvas.Left="80" FontSize="15" Foreground="Red"
              Content="My Button">
              <Button.RenderTransform>
                <ScaleTransform ScaleY="-1" />
              </Button.RenderTransform>
            </Button>
            <TextBlock Canvas.Top="120" Canvas.Left="20" FontSize="12pt"
              Foreground="Blue">
              <Bold>My Text Block</Bold>
              <TextBlock.RenderTransform>
                <ScaleTransform ScaleY="-1" />
              </TextBlock.RenderTransform>
            </TextBlock>
    </Canvas>
  </Border>
</Window>

   
    
    
    
    
    
     


Button IsMouseOver

image_pdfimage_print


   
       
<Window x:Class="PropertyTrigger.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="PropertyTrigger" 
  Height="300" 
  Width="300"
  >
  <Window.Resources>

    <Style TargetType="{x:Type Button}">
      <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
          <Setter Property="Background" Value="Orange" />
        </Trigger>
      </Style.Triggers>
    </Style>

  </Window.Resources>

  <Grid>
    
    <Button 
      VerticalAlignment="Top"
      HorizontalAlignment="Stretch"
      Height="46"
      Name="button1"
      >
      Button
    </Button>
    
  </Grid>
</Window>