Advertisement
Guest User

Untitled

a guest
Apr 27th, 2020
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. <Window x:Class="WPF_Training_2.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:WPF_Training_2"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="364.969" Background="#FF444444">
  9.  
  10. <Window.Resources>
  11. <ImageBrush x:Key="mouse_Over" ImageSource="Resources/Over.png" Stretch="None"/>
  12. <ImageBrush x:Key="mouse_Down" ImageSource="Resources/Down.png" Stretch="None"/>
  13. <ImageBrush x:Key="mouse_None" ImageSource="Resources/Default.png" Stretch="None"/>
  14.  
  15. <Style x:Key="FocusVisual">
  16. <Setter Property="Control.Template">
  17. <Setter.Value>
  18. <ControlTemplate>
  19. <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
  20. </ControlTemplate>
  21. </Setter.Value>
  22. </Setter>
  23. </Style>
  24. <Style x:Key="btnStyle1" TargetType="{x:Type Button}">
  25. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
  26. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  27. <Setter Property="BorderThickness" Value="1"/>
  28. <Setter Property="Padding" Value="1"/>
  29. <Setter Property="Template">
  30. <Setter.Value>
  31. <ControlTemplate TargetType="{x:Type Button}">
  32. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
  33. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  34. </Border>
  35. <ControlTemplate.Triggers>
  36. <Trigger Property="IsDefaulted" Value="true">
  37. <Setter Property="Background" TargetName="border" Value="{StaticResource mouse_None}"/>
  38. </Trigger>
  39. <Trigger Property="IsMouseOver" Value="true">
  40. <Setter Property="Background" TargetName="border" Value="{StaticResource mouse_Over}"/>
  41. </Trigger>
  42. <Trigger Property="IsPressed" Value="true">
  43. <Setter Property="Background" TargetName="border" Value="{StaticResource mouse_Down}"/>
  44. </Trigger>
  45. </ControlTemplate.Triggers>
  46. </ControlTemplate>
  47. </Setter.Value>
  48. </Setter>
  49. </Style>
  50. </Window.Resources>
  51.  
  52. <Grid>
  53. <Button Content="Hey" BorderThickness="0" Style="{DynamicResource btnStyle1}" Foreground="#FFFFC500" Width="100" Height="27" Margin="157,158,100,234">
  54. <Button.Background>
  55. <ImageBrush ImageSource="Resources/Default.png" Stretch="None"></ImageBrush>
  56. </Button.Background>
  57. </Button>
  58.  
  59. </Grid>
  60.  
  61.  
  62. </Window>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement