|
- <Window
- x:Class="BPASmartClient.CustomResource.Pages.View.MainView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
- Title="MainView"
- Width="1200"
- Height="700"
- AllowsTransparency="True"
- Background="{x:Null}"
- Topmost="False"
- WindowStartupLocation="CenterScreen"
- WindowStyle="None"
- mc:Ignorable="d">
-
- <Window.DataContext>
- <vm:MainViewModel />
- </Window.DataContext>
-
- <Window.Resources>
-
-
- <!--#region 静态资源-->
- <ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
- <ImageBrush x:Key="leftImageSub" ImageSource="../../Image/leftImageSub.png" />
- <ImageBrush x:Key="topImage" ImageSource="../../Image/topImage.png" />
- <!--#endregion-->
-
- <!--#region 标题栏按钮样式-->
- <Style x:Key="TitleBarStyle" TargetType="Button">
- <Setter Property="Foreground" Value="White" />
- <Setter Property="FontSize" Value="24" />
- <Setter Property="FontFamily" Value="../../Fonts/#iconfont" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Button">
- <Border Name="TitleBarBr" Background="Transparent">
- <ContentPresenter
- Margin="{TemplateBinding Margin}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="TitleBarBr" Property="Background" Value="#22ffffff" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region 导航栏样式-->
- <Style x:Key="NavButtonStyle" TargetType="{x:Type RadioButton}">
- <Setter Property="Foreground" Value="White" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RadioButton}">
- <Border
- x:Name="NvaBor"
- Background="Transparent"
- BorderBrush="#55ffffff"
- BorderThickness="0,0,0,1.5">
- <ContentControl
- Margin="10,4"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- HorizontalContentAlignment="Center"
- VerticalContentAlignment="Center"
- Content="{TemplateBinding Content}"
- FontSize="16" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="True">
- <Setter TargetName="NvaBor" Property="Background" Value="#865eec" />
- <Setter TargetName="NvaBor" Property="BorderThickness" Value="0,0,1.5,1.5" />
- </Trigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsChecked" Value="false" />
- <Condition Property="IsMouseOver" Value="True" />
- </MultiTrigger.Conditions>
- <MultiTrigger.Setters>
- <Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
- </MultiTrigger.Setters>
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region 下拉列表单选按钮样式-->
- <Style x:Key="RadioMiniButtonStyle" TargetType="{x:Type RadioButton}">
- <Setter Property="Margin" Value="5,10,1,5" />
- <Setter Property="Width" Value="160" />
- <Setter Property="Height" Value="30" />
- <Setter Property="FontSize" Value="14" />
- <Setter Property="FontFamily" Value="粗体" />
- <Setter Property="Foreground" Value="#DDD" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="HorizontalContentAlignment" Value="Center" />
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="Background" Value="#DDD" />
- <Setter Property="HorizontalAlignment" Value="Right" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RadioButton}">
- <Grid
- x:Name="templateRoot"
- Background="Transparent"
- SnapsToDevicePixels="True">
- <Border x:Name="border2" />
- <ContentPresenter
- x:Name="contentPresenter"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Content="{TemplateBinding Content}"
- ContentStringFormat="{TemplateBinding ContentStringFormat}"
- ContentTemplate="{TemplateBinding ContentTemplate}"
- Focusable="False"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
-
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="HasContent" Value="True">
- <Setter Property="FocusVisualStyle">
- <Setter.Value>
- <Style>
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate>
- <Rectangle
- Margin="14,0,0,0"
- SnapsToDevicePixels="True"
- Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
- StrokeDashArray="1 2"
- StrokeThickness="1" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Padding" Value="4,-1,0,0" />
- </Trigger>
- <Trigger Property="IsChecked" Value="{x:Null}" />
-
- <Trigger Property="IsChecked" Value="true">
- <Setter Property="Foreground" Value="White" />
- <Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImageSub}">
- <!--<Setter.Value>
- <ImageBrush ImageSource="./images/back.png" />
- </Setter.Value>-->
- </Setter>
- </Trigger>
-
- <Trigger Property="IsChecked" Value="false">
- <Setter TargetName="border2" Property="Background" Value="#101F3F" />
- <Setter Property="Foreground" Value="#4B8EC4" />
- </Trigger>
-
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsChecked" Value="false" />
- <Condition Property="IsMouseOver" Value="True" />
- </MultiTrigger.Conditions>
- <MultiTrigger.Setters>
- <Setter TargetName="border2" Property="Background" Value="#55007acc" />
- </MultiTrigger.Setters>
- </MultiTrigger>
-
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region 下拉列表样式-->
- <Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="Height" Value="80" />
- <Setter Property="HorizontalContentAlignment" Value="Right" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Padding" Value="10,10" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ToggleButton}">
- <Grid>
- <Border
- x:Name="border2"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Background="{TemplateBinding Background}">
- <ContentPresenter
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
- </Grid>
-
- <ControlTemplate.Triggers>
- <Trigger Property="IsPressed" Value="true">
- <Setter Property="Background" Value="#FFd2e7f4" />
- </Trigger>
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImage}" />
- </Trigger>
- <Trigger Property="IsChecked" Value="false">
- <Setter TargetName="border2" Property="Background" Value="#191E36" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="White" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
- <Setter Property="HorizontalContentAlignment" Value="Stretch" />
- <Setter Property="VerticalContentAlignment" Value="Stretch" />
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="BorderThickness" Value="1" />
-
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Expander}">
- <DockPanel>
- <ToggleButton
- x:Name="HeaderSite"
- Height="60"
- MinWidth="0"
- MinHeight="0"
- Margin="1"
- Padding="{TemplateBinding Padding}"
- HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
- Content="{TemplateBinding Header}"
- ContentTemplate="{TemplateBinding HeaderTemplate}"
- ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
- DockPanel.Dock="Top"
- FontFamily="{TemplateBinding FontFamily}"
- FontSize="{TemplateBinding FontSize}"
- FontStretch="{TemplateBinding FontStretch}"
- FontStyle="{TemplateBinding FontStyle}"
- FontWeight="{TemplateBinding FontWeight}"
- Foreground="{TemplateBinding Foreground}"
- IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
- Style="{StaticResource ToggleButtonStyle}" />
- <ContentPresenter
- x:Name="ExpandSite"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- DockPanel.Dock="Left"
- Focusable="false"
- Visibility="Collapsed" />
- </DockPanel>
- <ControlTemplate.Triggers>
- <Trigger Property="IsExpanded" Value="true">
- <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
- <Style x:Key="checkBoxStyle" TargetType="CheckBox">
- <Setter Property="Foreground" Value="#a2c2e8" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="FocusVisualStyle">
- <Setter.Value>
- <Style>
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate>
- <Rectangle
- Margin="1"
- SnapsToDevicePixels="True"
- Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
- StrokeDashArray="1 2"
- StrokeThickness="1" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type CheckBox}">
- <StackPanel
- Background="Transparent"
- Orientation="Horizontal"
- SnapsToDevicePixels="True">
- <Grid>
- <Image
- Width="12"
- Height="14"
- Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
- <Image
- x:Name="image1"
- Width="12"
- Height="14"
- Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
- </Grid>
- <ContentPresenter
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Content="{TemplateBinding Content}"
- ContentStringFormat="{TemplateBinding ContentStringFormat}"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </StackPanel>
- <ControlTemplate.Triggers>
- <Trigger Property="HasContent" Value="True">
- <Setter Property="FocusVisualStyle">
- <Setter.Value>
- <Style>
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate>
- <Rectangle
- Margin="14,0,0,0"
- SnapsToDevicePixels="True"
- Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
- StrokeDashArray="1 2"
- StrokeThickness="1" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Padding" Value="4,0,0,0" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
- </Trigger>
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
- </Trigger>
- <Trigger Property="IsChecked" Value="{x:Null}">
- <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="StatusBtnStyle告警" TargetType="ToggleButton">
- <Style.Setters>
- <Setter Property="Width" Value="30" />
- <Setter Property="Height" Value="19" />
- <Setter Property="Cursor" Value="Hand" />
- <Setter Property="IsChecked" Value="{Binding IsCheck, Mode=TwoWay}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ToggleButton">
- <Grid Cursor="Hand">
- <Border
- x:Name="bd1"
- Width="25"
- Height="13"
- Margin="0,-10,-5,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Panel.ZIndex="100"
- Background="#2600CAFF"
- CornerRadius="3"
- Cursor="Hand"
- Visibility="Collapsed">
- <TextBlock
- HorizontalAlignment="Center"
- FontSize="8"
- Foreground="#FF00E6F7"
- Text="{Binding ListNum, Mode=TwoWay}" />
- <!-- -->
- </Border>
- <Image
- x:Name="image1"
- Width="{TemplateBinding Width}"
- Height="{TemplateBinding Height}"
- Panel.ZIndex="0"
- RenderOptions.BitmapScalingMode="HighQuality"
- SnapsToDevicePixels="True"
- Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png"
- UseLayoutRounding="True" />
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" />
- <Setter TargetName="bd1" Property="Visibility" Value="Visible" />
- </Trigger>
- <Trigger Property="IsChecked" Value="False">
- <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" />
- <Setter TargetName="bd1" Property="Visibility" Value="Collapsed" />
- </Trigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsCheck}" Value="true" />
- <Condition Binding="{Binding IsAlarm}" Value="true" />
- </MultiDataTrigger.Conditions>
- <MultiDataTrigger.Setters>
- <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" />
- <Setter TargetName="bd1" Property="Visibility" Value="Visible" />
- </MultiDataTrigger.Setters>
- </MultiDataTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style.Setters>
- </Style>
- </Window.Resources>
-
- <Grid Background="#103153">
-
- <Grid.RowDefinitions>
- <RowDefinition Height="50" />
- <RowDefinition />
- </Grid.RowDefinitions>
-
- <!--#region 标题栏设置-->
- <Border
- x:Name="MoveBorder"
- Height="50"
- VerticalAlignment="Top"
- Background="#0C2349"
- BorderBrush="#55ffffff"
- BorderThickness="0,0,0,1">
-
- <StackPanel Orientation="Horizontal">
- <Image Margin="15,5,0,5" Source="../../Image/HBL.png" />
- <TextBlock
- Name="tbTitle"
- Margin="20,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- FontSize="18"
- Foreground="White"
- Text="自动化产线上位机控制系统软件 V1.0" />
- </StackPanel>
-
-
- </Border>
-
- <UniformGrid
- Width="150"
- Height="50"
- HorizontalAlignment="Right"
- Columns="3">
- <Button
- Name="ButMin"
- Content=""
- IsEnabled="False"
- Style="{StaticResource TitleBarStyle}"
- Visibility="Hidden" />
- <Button
- Name="ButMax"
- Content=""
- FontSize="22"
- IsEnabled="False"
- Style="{StaticResource TitleBarStyle}"
- Visibility="Hidden" />
- <Button
- Name="ButClose"
- Content=""
- Foreground="Red"
- Style="{StaticResource TitleBarStyle}" />
- </UniformGrid>
- <!--#endregion-->
-
- <!--#region 显示区设置-->
-
- <Grid Grid.Row="1">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="200" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
-
- <!-- 侧边栏菜单设置 -->
- <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
- <Grid>
- <Border BorderBrush="#121F40" BorderThickness="1">
- <Border.Background>
- <ImageBrush ImageSource="../../Image/leftback.png" />
- </Border.Background>
- </Border>
-
- <ScrollViewer
- Name="scroll"
- Grid.Row="1"
- Margin="10"
- HorizontalScrollBarVisibility="Hidden"
- VerticalScrollBarVisibility="Hidden">
- <ItemsControl ItemsSource="{Binding menuModels}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Grid Visibility="{Binding MainMenuVisibility}">
- <Expander x:Name="E1" Style="{DynamicResource ExpanderStyle}">
- <Expander.Header>
- <StackPanel
- Margin="10,0,0,10"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <TextBlock
- VerticalAlignment="Center"
- FontFamily="../../Fonts/#iconfont"
- FontSize="25"
- Foreground="#ddd"
- Text="{Binding MainMenuIcon, Converter={StaticResource StringToIconConverter}}" />
- <StackPanel Margin="10,0,0,0" VerticalAlignment="Center">
- <TextBlock
- FontSize="16"
- Foreground="White"
- Text="{Binding MainMenuName}" />
- <TextBlock
- FontSize="13"
- Foreground="Gray"
- Text="{Binding Alias}" />
- </StackPanel>
- </StackPanel>
- </Expander.Header>
- <Expander.Content>
- <StackPanel>
- <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
- <ItemsControl ItemsSource="{Binding subMenumodels}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <RadioButton
- Command="{Binding DataContext.NavChangedCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
- CommandParameter="{Binding}"
- Content="{Binding SubMenuName}"
- GroupName="All"
- Style="{StaticResource RadioMiniButtonStyle}"
- Visibility="{Binding SubMenuVisibility}" />
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </StackPanel>
- </Expander.Content>
- </Expander>
- </Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </Grid>
- </ScrollViewer>
- <!--#endregion-->
-
- <!--#region 页面显示-->
- <Grid Grid.Column="1">
- <Grid.Background>
- <ImageBrush ImageSource="../../Image/WindowImages.png" />
- </Grid.Background>
-
- <Grid.RowDefinitions>
- <RowDefinition Height="0.1*" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
- <ToggleButton
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Cursor="Hand"
- IsChecked="{Binding IsAlarm}"
- Style="{DynamicResource StatusBtnStyle告警}"
- ToolTip="心跳检测报警" Margin="0,0,8,0"/>
- <CheckBox
- Margin="5,0,8,0"
- Content="开机启动"
- IsChecked="{Binding AutoStart}"
- Style="{StaticResource checkBoxStyle}" />
- <!--<CheckBox
- Margin="5,0,5,0"
- Content="设备初始化"
- IsChecked="{Binding Status}"
- Style="{StaticResource checkBoxStyle}" />-->
- </StackPanel>
- <TextBlock
- Margin="0,0,0,20"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontSize="20"
- Foreground="#1A8ADE"
- Text="{Binding DisplayName}" />
-
- <TextBlock
- Margin="10,10,0,5"
- HorizontalAlignment="left"
- VerticalAlignment="Center"
- FontSize="18"
- Foreground="#1A8ADE"
- Text="{Binding DateVisible}" />
-
- <TextBlock
- Margin="0,10,50,5"
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- FontSize="18"
- Foreground="#1A8ADE"
- Text="{Binding TimeVisible}" />
- <ContentControl
- Grid.Row="1"
- Width="auto"
- Height="auto"
- Content="{Binding MainContent}" />
-
- </Grid>
-
- <!--#endregion-->
-
- </Grid>
-
-
- <!--#endregion-->
-
- </Grid>
-
- </Window>
|