Newer
Older
SubCabinetSolution / SubCabinetSolution / Views / CabinetWindow.xaml
<Window
    x:Class="SubCabinetSolution.Views.CabinetWindow"
    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:interactivity="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit"
    Title="高值耗材柜(科室)"
    Width="1366"
    Height="768"
    Background="White"
    ResizeMode="CanResize"
    WindowStartupLocation="CenterScreen"
    WindowState="Maximized"
    mc:Ignorable="d">

    <Window.DataContext>
        <Binding Path="CabinetWindow" Source="{StaticResource Locator}" />
    </Window.DataContext>

    <Window.Resources>
        <Style x:Key="UserDefineBorderStyle" TargetType="Border">
            <Setter Property="Width" Value="80" />
            <Setter Property="Height" Value="80" />
            <Setter Property="Background" Value="{DynamicResource MainThemeColor}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="CornerRadius" Value="5" />
        </Style>
    </Window.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="240" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Border
            Grid.Column="0"
            Background="White"
            BorderBrush="#F1F1F1"
            BorderThickness="0,0,1,0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="60" />
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <TextBlock
                    Grid.Row="0"
                    Padding="0,20"
                    Background="{DynamicResource MainThemeColor}"
                    FontSize="18"
                    FontWeight="Bold"
                    Foreground="White"
                    Text="航天203所"
                    TextAlignment="Center" />

                <!--  左边八个功能Item  -->
                <ListBox
                    Grid.Row="1"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    BorderThickness="0"
                    ItemsSource="{Binding FunctionModels}"
                    SelectedItem="{Binding FunctionModels[7]}">

                    <interactivity:Interaction.Triggers>
                        <interactivity:EventTrigger EventName="SelectionChanged">
                            <interactivity:InvokeCommandAction Command="{Binding FuncSelectedCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" />
                        </interactivity:EventTrigger>
                    </interactivity:Interaction.Triggers>

                    <ListBox.Template>
                        <ControlTemplate TargetType="{x:Type ListBox}">
                            <WrapPanel IsItemsHost="True" Orientation="Horizontal" />
                        </ControlTemplate>
                    </ListBox.Template>

                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border x:Name="ListBoxItemBorder" Style="{StaticResource UserDefineBorderStyle}">
                                <StackPanel VerticalAlignment="Bottom">
                                    <Border
                                        x:Name="ImageBorder"
                                        Margin="5"
                                        HorizontalAlignment="Center"
                                        Background="{DynamicResource MainThemeColor}"
                                        CornerRadius="5">
                                        <Image
                                            Width="40"
                                            Height="40"
                                            Source="{Binding Image}" />
                                    </Border>

                                    <TextBlock
                                        Margin="0,5"
                                        FontFamily="微软雅黑"
                                        FontSize="14"
                                        Text="{Binding Title}"
                                        TextAlignment="Center" />
                                </StackPanel>
                            </Border>

                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}, AncestorLevel=1}}" Value="True">
                                    <Setter Property="IsHitTestVisible" Value="True" />
                                    <Setter TargetName="ListBoxItemBorder" Property="Background" Value="#00ADF9" />
                                    <Setter TargetName="ImageBorder" Property="Background" Value="#00ADF9" />
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </ListBox.ItemTemplate>

                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="OverridesDefaultStyle" Value="True" />
                            <Setter Property="VerticalContentAlignment" Value="Center" />
                            <Setter Property="HorizontalContentAlignment" Value="Center" />
                            <Setter Property="FontSize" Value="14" />
                            <Setter Property="Width" Value="100" />
                            <Setter Property="Height" Value="90" />
                            <Setter Property="Margin" Value="0,5" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <Border
                                            x:Name="ListBoxItemBorder"
                                            Margin="10,0"
                                            TextBlock.Foreground="White">
                                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="ListBoxItemBorder" Property="BorderBrush" Value="#00E3C7" />
                                                <Setter TargetName="ListBoxItemBorder" Property="BorderThickness" Value="0,0,0,3" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>

                <!--  底部三个功能Item  -->
                <ListBox
                    Grid.Row="2"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    BorderThickness="0"
                    ItemsSource="{Binding SettingsModels}">

                    <interactivity:Interaction.Triggers>
                        <interactivity:EventTrigger EventName="SelectionChanged">
                            <interactivity:InvokeCommandAction Command="{Binding SettingsSelectedCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" />
                        </interactivity:EventTrigger>
                    </interactivity:Interaction.Triggers>

                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel IsItemsHost="True" Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>

                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <Image
                                    Width="32"
                                    Height="32"
                                    Margin="0,5,0,0"
                                    Source="{Binding Image}" />
                                <TextBlock
                                    Margin="0,5"
                                    FontFamily="微软雅黑"
                                    Text="{Binding Title}"
                                    TextAlignment="Center" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>

                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="OverridesDefaultStyle" Value="True" />
                            <Setter Property="HorizontalContentAlignment" Value="Center" />
                            <Setter Property="Foreground" Value="{DynamicResource MainThemeColor}" />
                            <Setter Property="FontSize" Value="12" />
                            <Setter Property="Width" Value="65" />
                            <Setter Property="Height" Value="65" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <Border x:Name="ListBoxItemBorder" CornerRadius="5">
                                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="true">
                                                <Setter TargetName="ListBoxItemBorder" Property="Background" Value="#CCD9E3ED" />
                                            </Trigger>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="ListBoxItemBorder" Property="Opacity" Value="0.6" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>
            </Grid>
        </Border>

        <DockPanel Grid.Column="1">
            <Border
                Height="50"
                Background="White"
                BorderBrush="#F1F1F1"
                BorderThickness="0,0,0,1"
                DockPanel.Dock="Top">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="180" />
                        <ColumnDefinition />
                        <ColumnDefinition Width="180" />
                    </Grid.ColumnDefinitions>

                    <StackPanel Grid.Column="0" Orientation="Horizontal">
                        <Border
                            Width="40"
                            Height="40"
                            Margin="5"
                            HorizontalAlignment="Center"
                            Background="{DynamicResource MainThemeColor}"
                            CornerRadius="5">
                            <Image
                                Width="28"
                                Height="28"
                                Margin="5"
                                Source="{Binding MainTopImage}" />
                        </Border>

                        <Image
                            Width="16"
                            Height="16"
                            Margin="5,0"
                            Source="/Images/right.png" />

                        <TextBlock
                            VerticalAlignment="Center"
                            FontSize="18"
                            Foreground="#7D97AE"
                            Text="{Binding MainTopTitle}"
                            TextAlignment="Center" />
                    </StackPanel>

                    <StackPanel
                        Grid.Column="1"
                        HorizontalAlignment="Center"
                        Orientation="Horizontal"
                        Visibility="{Binding IsTopSearchBarVisible}">
                        <widgets:PlaceHolderTextBox
                            Width="300"
                            Height="30"
                            Padding="3,0"
                            VerticalContentAlignment="Center"
                            BorderCornerRadius="3"
                            Foreground="{DynamicResource MainTextColor}"
                            HintText="请输入要查询的关键字"
                            MouseOverBorderColor="Blue"
                            PlaceHolderPadding="5"
                            Text="{Binding UserInputKeywords}" />

                        <widgets:CornerRadiusButton
                            Width="60"
                            Height="30"
                            Margin="10,0"
                            Background="#FFD9E3ED"
                            BorderCornerRadius="5"
                            Command="{Binding SearchDataCommand}"
                            Content="&#xe67d;"
                            FontFamily="/SubCabinetSolution;component/IconFont/#iconfont"
                            FontSize="20"
                            Foreground="#809AB1"
                            MouseOverBackground="#AAD9E3ED" />
                    </StackPanel>

                    <DockPanel Grid.Column="2" LastChildFill="False">
                        <StackPanel
                            VerticalAlignment="Center"
                            DockPanel.Dock="Left"
                            Orientation="Vertical">
                            <DockPanel Width="120" LastChildFill="True">
                                <TextBlock
                                    DockPanel.Dock="Left"
                                    FontSize="18"
                                    Foreground="#7D97AE"
                                    Text="21146" />

                                <TextBlock
                                    Padding="0,5,2,0"
                                    Foreground="#7D97AE"
                                    Text="手术室"
                                    TextAlignment="Right" />
                            </DockPanel>
                            <TextBlock
                                Width="120"
                                Foreground="#7D97AE"
                                Text="{Binding CurrentTime}" />
                        </StackPanel>


                        <widgets:CornerRadiusButton
                            Width="50"
                            Height="50"
                            Background="Transparent"
                            BorderBrush="{x:Null}"
                            Command="{Binding LoginOutCommand}"
                            CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
                            DockPanel.Dock="Right">
                            <StackPanel>
                                <TextBlock
                                    FontFamily="/SubCabinetSolution;component/IconFont/#iconfont"
                                    FontSize="20"
                                    Foreground="#7D97AE"
                                    Text="&#xe67e;" />

                                <TextBlock
                                    Margin="0,3"
                                    FontSize="12"
                                    Foreground="#7D97AE"
                                    Text="退出"
                                    TextAlignment="Center" />
                            </StackPanel>
                        </widgets:CornerRadiusButton>
                    </DockPanel>
                </Grid>
            </Border>

            <!--  中间显示区域  -->
            <UniformGrid DockPanel.Dock="Bottom">
                <Frame
                    x:Name="CabinetFunctionFrame"
                    NavigationUIVisibility="Hidden"
                    Source="CabinetMainPage.xaml" />
                <!--  加载默认Page页  -->
            </UniformGrid>
        </DockPanel>
    </Grid>
</Window>