<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=""/>
|
|
<Label Margin="10,0,0,0" FontSize="25" FontWeight="Bold"
|
VerticalAlignment="Center" Content="{Binding AlarmInfo}"/>
|
|
</DockPanel>
|
</Border>
|
</Grid>
|
</UserControl>
|