alielie
2025-10-10 15bbd62b0b24b72c717ae91ab45348a2083ad04e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ui="clr-namespace:HMI.UI"
                    x:Class="HMI.UI.BaseWindowTemplate">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
        <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
        <ResourceDictionary Source="/HMI.UI;component/Style/WindowResources.xaml"/>
    </ResourceDictionary.MergedDictionaries>
 
    <Style TargetType="ui:BaseWindow" x:Key="BaseWindow">
        <Setter Property="WindowChrome.WindowChrome">
            <Setter.Value>
                <WindowChrome CornerRadius="0" CaptionHeight="40" GlassFrameThickness="0"
      UseAeroCaptionButtons="False" NonClientFrameEdges="None"  />
            </Setter.Value>
        </Setter>
 
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ui:BaseWindow">
                    <Border BorderThickness="1" BorderBrush="Gray">
                        <Grid x:Name="mainGrid" Background="#FFF">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="40"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
 
                            <Grid Grid.Row="0" Background="{StaticResource PrimaryColor}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <StackPanel x:Name="LeftPanel" Orientation="Horizontal" Grid.Column="0">
                                    <Border x:Name="TitlePanel">
                                        <Label VerticalContentAlignment="Center" Foreground="#FFF" Content="{TemplateBinding Title}"/>
                                    </Border>
                                </StackPanel>
                                <StackPanel x:Name="RightPanel" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
                                    <Button Style="{StaticResource WindowButton}" Click="Min_Click">&#xe650;</Button>
                                    <Button Style="{StaticResource WindowButton}" Click="Max_Click">&#xe602;</Button>
                                    <Button Style="{StaticResource WindowCloseButton}" Click="Close_Click">&#xe609;</Button>
                                </StackPanel>
                            </Grid>
                            <AdornerDecorator Grid.Row="1">
                                <ContentPresenter  Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"  />
                            </AdornerDecorator>
                        </Grid>
                    </Border>
 
                    <ControlTemplate.Triggers>
                        <Trigger Property="WindowState" Value="Maximized">
                            <Setter TargetName="mainGrid" Property="Margin" Value="8,8,8,8"></Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
</ResourceDictionary>