Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Style TargetType="Window">
- <Setter Property="SnapsToDevicePixels" Value="True"/>
- <Setter Property="Background" Value="DarkGray"/>
- <Setter Property="Title" Value="My custom window"/>
- <Setter Property="WindowChrome.WindowChrome">
- <Setter.Value>
- <WindowChrome ResizeBorderThickness="5" CaptionHeight="30" GlassFrameThickness="0" CornerRadius="0"/>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Window">
- <Border BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
- <Grid Background="Transparent">
- <!-- Title bar -->
- <Border Background="White" Height="30" VerticalAlignment="Top">
- <Grid>
- <!-- Window title -->
- <TextBlock Text="{TemplateBinding Title}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
- <!-- Window control buttons stack -->
- <StackPanel HorizontalAlignment="Right">
- <!-- Close button, for example -->
- <Button Width="40" Height="30" Background="White" WindowChrome.IsHitTestVisibleInChrome="True" Click="Button_Click">
- <Path Data="M0,0 L20,20 M0,20 L20,0" Stroke="Black" StrokeThickness="1"/>
- </Button>
- </StackPanel>
- </Grid>
- </Border>
- <!-- Window content -->
- <AdornerDecorator>
- <ContentPresenter Margin="0,30,0,0"/>
- </AdornerDecorator>
- </Grid>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement