Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. <Style TargetType="Window">
  2. <Setter Property="SnapsToDevicePixels" Value="True"/>
  3. <Setter Property="Background" Value="DarkGray"/>
  4. <Setter Property="Title" Value="My custom window"/>
  5. <Setter Property="WindowChrome.WindowChrome">
  6. <Setter.Value>
  7. <WindowChrome ResizeBorderThickness="5" CaptionHeight="30" GlassFrameThickness="0" CornerRadius="0"/>
  8. </Setter.Value>
  9. </Setter>
  10. <Setter Property="Template">
  11. <Setter.Value>
  12. <ControlTemplate TargetType="Window">
  13. <Border BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
  14. <Grid Background="Transparent">
  15.  
  16. <!-- Title bar -->
  17. <Border Background="White" Height="30" VerticalAlignment="Top">
  18. <Grid>
  19. <!-- Window title -->
  20. <TextBlock Text="{TemplateBinding Title}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
  21.  
  22. <!-- Window control buttons stack -->
  23. <StackPanel HorizontalAlignment="Right">
  24. <!-- Close button, for example -->
  25. <Button Width="40" Height="30" Background="White" WindowChrome.IsHitTestVisibleInChrome="True" Click="Button_Click">
  26. <Path Data="M0,0 L20,20 M0,20 L20,0" Stroke="Black" StrokeThickness="1"/>
  27. </Button>
  28. </StackPanel>
  29. </Grid>
  30. </Border>
  31.  
  32. <!-- Window content -->
  33. <AdornerDecorator>
  34. <ContentPresenter Margin="0,30,0,0"/>
  35. </AdornerDecorator>
  36. </Grid>
  37. </Border>
  38. </ControlTemplate>
  39. </Setter.Value>
  40. </Setter>
  41. </Style>
  42.  
  43. </Window.Style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement