Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window x:Class="WPF_Training_2.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:WPF_Training_2"
- mc:Ignorable="d"
- Title="MainWindow" Height="450" Width="364.969" Background="#FF444444">
- <Window.Resources>
- <ImageBrush x:Key="mouse_Over" ImageSource="Resources/Over.png" Stretch="None"/>
- <ImageBrush x:Key="mouse_Down" ImageSource="Resources/Down.png" Stretch="None"/>
- <ImageBrush x:Key="mouse_None" ImageSource="Resources/Default.png" Stretch="None"/>
- <Style x:Key="FocusVisual">
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate>
- <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="btnStyle1" TargetType="{x:Type Button}">
- <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
- <Setter Property="BorderThickness" Value="1"/>
- <Setter Property="Padding" Value="1"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
- <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsDefaulted" Value="true">
- <Setter Property="Background" TargetName="border" Value="{StaticResource mouse_None}"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Background" TargetName="border" Value="{StaticResource mouse_Over}"/>
- </Trigger>
- <Trigger Property="IsPressed" Value="true">
- <Setter Property="Background" TargetName="border" Value="{StaticResource mouse_Down}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Resources>
- <Grid>
- <Button Content="Hey" BorderThickness="0" Style="{DynamicResource btnStyle1}" Foreground="#FFFFC500" Width="100" Height="27" Margin="157,158,100,234">
- <Button.Background>
- <ImageBrush ImageSource="Resources/Default.png" Stretch="None"></ImageBrush>
- </Button.Background>
- </Button>
- </Grid>
- </Window>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement