alielie
2026-04-16 1afe548ac40cc7f975917ef9bf2e156595cf81f3
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<UserControl x:Class="WPFProject.Controls.MainTabControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WPFProject.Controls"
             mc:Ignorable="d" 
             Loaded="UserControl_Loaded"
             Foreground="#51555f"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
            </ResourceDictionary.MergedDictionaries>
 
            <Style TargetType="ListBox" x:Key="ListBoxItemStyle1">
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Padding" Value="-1"/>
                <Setter Property="ItemContainerStyle">
                    <Setter.Value>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="Margin" Value="0"/>
                            <Setter Property="Padding" Value="0"/>
                            <Setter Property="Foreground" Value="{StaticResource PrimaryColorContract}"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ListBoxItem">
                                        <Border x:Name="border" Padding="10,5" BorderBrush="{StaticResource PrimaryColor}"
                                                Cursor="Hand"
                                                BorderThickness="1,0,0,0"
                                                >
                                            <ContentPresenter x:Name="cp" Content="{TemplateBinding Content}" 
ContentStringFormat="{TemplateBinding ContentStringFormat}" 
ContentTemplate="{TemplateBinding ContentTemplate}" />
                                        </Border>
 
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter TargetName="border" Property="Background" 
                                                        Value="#7093d3"/>
                                                <Setter Property="Foreground" Value="#ffff95"/>
                                            </Trigger>
 
                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=(ItemsControl.AlternationIndex)}" Value="0">
                                                <Setter TargetName="border" Property="BorderThickness" Value="0" />
                                            </DataTrigger>
 
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="border" Property="Background" Value="#7093d3" />
                                                <Setter Property="Foreground" Value="{StaticResource SecondPrimaryColorContract}" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
                                <!--<Image Width="20" Height="20" Margin="5" Source="{Binding Icon}"/>-->
                                <Label Width="20" Height="20" FontFamily="{StaticResource iconfont}"
                                       Padding="0"
                                       Foreground="{Binding Foreground,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBoxItem}}"
                                       VerticalAlignment="Center"
                                       VerticalContentAlignment="Center" 
                                       FontSize="20" Content="{Binding IconFont}"/>
                                <Label x:Name="txt" BorderThickness="0" 
                                       Foreground="{Binding Foreground,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBoxItem}}"
                                       FontWeight="Bold"
                                       VerticalContentAlignment="Center" 
                                       HorizontalAlignment="Left"
                                       Content="{Binding Name}" ToolTip="{Binding Name}"/>
                            </StackPanel>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
 
            <Style TargetType="ListBox" x:Key="ListBoxItemStyle2" BasedOn="{StaticResource ListBoxItemStyle1}">
                <Setter Property="ItemContainerStyle">
                    <Setter.Value>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="Margin" Value="0"/>
                            <Setter Property="Padding" Value="0"/>
                            <Setter Property="Foreground" Value="{StaticResource PrimaryColorContract}"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ListBoxItem">
                                        <Border x:Name="border" Padding="0,10" Margin="0" Cursor="Hand">
                                            <ContentPresenter x:Name="cp" Content="{TemplateBinding Content}" 
ContentStringFormat="{TemplateBinding ContentStringFormat}" 
ContentTemplate="{TemplateBinding ContentTemplate}"  />
                                        </Border>
 
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter Property="Foreground" Value="#ffff95"/>
                                            </Trigger>
 
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="border" Property="Background" Value="#7093d3" />
                                                <Setter Property="Foreground" Value="{StaticResource SecondPrimaryColorContract}" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
                                <Label x:Name="txt"
                       Foreground="{Binding Foreground,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBoxItem}}"
                       FontWeight="Bold"
                       VerticalContentAlignment="Center" 
                       HorizontalContentAlignment="Center" 
                                       Padding="10,0"
                       VerticalAlignment="Center"
                       BorderThickness="1,0,0,0" BorderBrush="Wheat"
                       Content="{Binding Name}" ToolTip="{Binding Name}"/>
                            </StackPanel>
 
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem},AncestorLevel=1},
                                    Path=(ItemsControl.AlternationIndex)}" Value="0">
                                    <Setter TargetName="txt" Property="BorderBrush" Value="Transparent"/>
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
 
    <Grid x:Name="mainGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
 
        <Border Grid.Row="0" BorderThickness="0,1,0,0" BorderBrush="#93b7ea" 
 Visibility="{Binding MenuVisibility}">
            <DockPanel Background="Transparent">
                <Border DockPanel.Dock="Left" BorderThickness="1,1,0,1" Background="Transparent" BorderBrush="{StaticResource PrimaryColor}" Width="50"></Border>
                <ListBox DockPanel.Dock="Left" Grid.Row="0" x:Name="Menu"
 Style="{StaticResource ListBoxItemStyle1}" FontSize="14"
 BorderBrush="{StaticResource PrimaryColor}"
 BorderThickness="1"
 SelectionChanged="Menu_SelectionChanged"
 SelectedItem="{Binding SelectedMenu}"
 AlternationCount="{Binding MenuItems.Count}" ItemsSource="{Binding MenuItems}">
 
                </ListBox>
                <Border DockPanel.Dock="Left" BorderThickness="0,1,1,1" BorderBrush="{StaticResource PrimaryColor}"></Border>
            </DockPanel>
        </Border>
 
 
        <Border Grid.Row="1" BorderThickness="0,1" BorderBrush="#93b7ea" 
 Visibility="{Binding MenuVisibility}">
            <DockPanel  Background="Transparent">
                <Border Margin="1,1,0,1" DockPanel.Dock="Left" Background="Transparent" Width="50"></Border>
                <ListBox Grid.Row="1" x:Name="SubMenu" Margin="0" FontSize="14"
         Style="{StaticResource ListBoxItemStyle2}"
         BorderBrush="Gray"
                 Visibility="{Binding MenuVisibility}"
                 SelectedItem="{Binding SelectedSubMenu,Mode=OneWay}" AlternationCount="{Binding SubMenuItems.Count}"
                 SelectionChanged="SubMenu_SelectionChanged" BorderThickness="0" ItemsSource="{Binding SubMenuItems}" >
                </ListBox>
            </DockPanel>
        </Border>
 
        <Border x:Name="page"  Grid.Row="2" BorderThickness="0" Margin="0" Background="White" Padding="0">
 
        </Border>
 
        <Border Height="80" Grid.Row="2" Background="Red" Visibility="Collapsed" VerticalAlignment="Top" x:Name="alarmBorder">
            <Border.Style>
                <Style TargetType="Border">
                    <Style.Triggers>
                        <Trigger Property="Visibility" Value="Visible">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                    From="#ff2100" 
                    To="#fe7975" 
                    Duration="0:0:0.7"
                    AutoReverse="True"
                    RepeatBehavior="Forever"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Border.Style>
 
            <DockPanel>
                <Button DockPanel.Dock="Right" 
                FontSize="25" 
                FontWeight="Bold"
                Margin="0,10,10,0"
                VerticalAlignment="Top"
                Click="Button_Click_1"
                FontFamily="{StaticResource iconfont}" Background="Transparent" Content="&#xe609;"/>
 
                <Label Margin="10,0,0,0" FontSize="25" FontWeight="Bold" 
               VerticalAlignment="Center" Content="{Binding AlarmInfo}"/>
 
            </DockPanel>
        </Border>
    </Grid>
</UserControl>