641 lines
43 KiB
XML
641 lines
43 KiB
XML
<hc:Window x:Class="YY.Admin.Views.MainWindow"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||
xmlns:prism="http://prismlibrary.com/"
|
||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||
xmlns:views="clr-namespace:YY.Admin.Views.Control"
|
||
xmlns:helper="clr-namespace:YY.Admin.Core.Helper;assembly=YY.Admin.Core"
|
||
xmlns:beh="clr-namespace:YY.Admin.Core.Behavior;assembly=YY.Admin.Core"
|
||
xmlns:consts="clr-namespace:YY.Admin.Core.Const;assembly=YY.Admin.Core"
|
||
xmlns:core="clr-namespace:YY.Admin.Core;assembly=YY.Admin.Core"
|
||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||
xmlns:ctls="clr-namespace:YY.Admin.Core.Controls;assembly=YY.Admin.Core"
|
||
xmlns:converter="clr-namespace:YY.Admin.Core.Converter;assembly=YY.Admin.Core"
|
||
Icon="/Resources/Icon/logo.ico"
|
||
Title="{x:Static consts:CommonConst.SystemName}"
|
||
Width="1200"
|
||
Height="800"
|
||
WindowStartupLocation="CenterScreen"
|
||
WindowState="Maximized"
|
||
FontSize="{StaticResource FontSize}">
|
||
|
||
<Grid>
|
||
<DockPanel>
|
||
<!-- 顶部导航栏 -->
|
||
<Border
|
||
DockPanel.Dock="Top"
|
||
Height="60"
|
||
BorderThickness="0 0 0 1"
|
||
BorderBrush="{DynamicResource BorderBrush}"
|
||
Background="{DynamicResource RegionBrush}">
|
||
<Grid>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<!-- 左侧标题 -->
|
||
<StackPanel
|
||
Orientation="Horizontal"
|
||
VerticalAlignment="Center"
|
||
Margin="20,0,0,0">
|
||
<Image
|
||
Source="/Resources/Icon/logo.png"
|
||
Width="60"
|
||
Height="60"
|
||
VerticalAlignment="Center"/>
|
||
<TextBlock
|
||
Text="{x:Static consts:CommonConst.SystemName}"
|
||
FontSize="24"
|
||
FontWeight="Bold"
|
||
VerticalAlignment="Center"
|
||
Margin="5,0,0,0"/>
|
||
</StackPanel>
|
||
|
||
<!-- 右侧用户信息 -->
|
||
<StackPanel
|
||
Grid.Column="1"
|
||
Orientation="Horizontal"
|
||
VerticalAlignment="Center"
|
||
Margin="20,0">
|
||
|
||
<!-- 服务器设置 -->
|
||
<Button BorderThickness="0" Height="60" Padding="12,0" ToolTip="服务器设置" Command="{Binding OpenServerSettingsCommand}">
|
||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||
<ctls:FontAwesomeIcon FontSize="16" Icon="" Margin="0,0,0,2"/>
|
||
<TextBlock Text="服务器设置" FontSize="11" HorizontalAlignment="Center"/>
|
||
</StackPanel>
|
||
</Button>
|
||
|
||
<!-- 消息通知 -->
|
||
<hc:Badge
|
||
Value="100"
|
||
BadgeMargin="0,4,-10,0"
|
||
FontSize="12"
|
||
Style="{StaticResource BadgeDanger}"
|
||
Margin="10,0">
|
||
<Button BorderThickness="0" Height="60" Padding="20,0" ToolTip="消息通知">
|
||
<ctls:FontAwesomeIcon FontSize="20" Icon=""/>
|
||
</Button>
|
||
</hc:Badge>
|
||
|
||
<!-- 用户信息 -->
|
||
<StackPanel
|
||
Orientation="Horizontal"
|
||
VerticalAlignment="Center"
|
||
Margin="10,0">
|
||
<hc:Gravatar Width="40" Height="40" Style="{StaticResource GravatarCircleImg}" Source="/Resources/Icon/avatar.png"/>
|
||
<StackPanel Margin="8,0,0,0" VerticalAlignment="Center">
|
||
<TextBlock
|
||
Text="{Binding CurrentUser.RealName, FallbackValue=管理员}"
|
||
FontWeight="Bold"
|
||
FontSize="14"
|
||
Margin="0,0,0,3"/>
|
||
<TextBlock
|
||
Text="{Binding CurrentUser.AccountType, FallbackValue=Administrator}"
|
||
FontSize="12"
|
||
Foreground="{DynamicResource SecondaryTextBrush}"/>
|
||
</StackPanel>
|
||
</StackPanel>
|
||
</StackPanel>
|
||
</Grid>
|
||
</Border>
|
||
|
||
<!-- 底部版权栏 -->
|
||
<Border
|
||
DockPanel.Dock="Bottom"
|
||
Height="30"
|
||
Background="{DynamicResource RegionBrush}"
|
||
BorderThickness="0,1,0,0"
|
||
BorderBrush="{DynamicResource BorderBrush}">
|
||
<Grid>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<!-- 左侧系统名称 -->
|
||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="10,0">
|
||
<Ellipse Width="8"
|
||
Height="8"
|
||
Fill="{Binding BackendConnectionStatusBrush}"
|
||
VerticalAlignment="Center"
|
||
Margin="0,0,6,0"/>
|
||
<TextBlock Text="星数连科技科技有限公司"
|
||
VerticalAlignment="Center"
|
||
FontSize="12"
|
||
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||
</StackPanel>
|
||
|
||
<!-- 右侧版权信息 -->
|
||
<TextBlock
|
||
Grid.Column="1"
|
||
Text="Copyright © 2026 XSL All rights reserved."
|
||
VerticalAlignment="Center"
|
||
Margin="10,0"
|
||
FontSize="12"
|
||
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||
</Grid>
|
||
</Border>
|
||
|
||
<!-- Sidebar侧边栏 -->
|
||
<views:SidebarControl x:Name="LeftSidebar" DockPanel.Dock="Left" Width="80"/>
|
||
|
||
<Grid x:Name="MainContentGrid">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition x:Name="LeftMenuTreeCol">
|
||
<ColumnDefinition.Style>
|
||
<Style TargetType="ColumnDefinition">
|
||
<Setter Property="Width" Value="250"/>
|
||
<Setter Property="MinWidth" Value="50"/>
|
||
<Setter Property="MaxWidth" Value="{Binding ActualWidth, ElementName=MainContentGrid, Converter={StaticResource MaxWidthConverter}, ConverterParameter=50}"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding IsMenuTreePanelCollapsed}" Value="True">
|
||
<Setter Property="Width" Value="0"/>
|
||
<Setter Property="MinWidth" Value="0"/>
|
||
<Setter Property="MaxWidth" Value="0"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</ColumnDefinition.Style>
|
||
</ColumnDefinition>
|
||
<ColumnDefinition>
|
||
<ColumnDefinition.Style>
|
||
<Style TargetType="ColumnDefinition">
|
||
<Setter Property="Width" Value="4"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding IsMenuTreePanelCollapsed}" Value="True">
|
||
<Setter Property="Width" Value="0"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</ColumnDefinition.Style>
|
||
</ColumnDefinition>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
<!-- Sidebar侧边栏区域 -->
|
||
<Border
|
||
x:Name="LeftMenuTree"
|
||
BorderThickness="0,0,1,0"
|
||
BorderBrush="{DynamicResource BorderBrush}"
|
||
Background="{DynamicResource RegionBrush}">
|
||
<Border.Style>
|
||
<Style TargetType="Border">
|
||
<Setter Property="Visibility" Value="Visible"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding IsMenuTreePanelCollapsed}" Value="True">
|
||
<Setter Property="Visibility" Value="Collapsed"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</Border.Style>
|
||
<ContentControl prism:RegionManager.RegionName="{x:Static consts:CommonConst.MenuRegion}"/>
|
||
</Border>
|
||
<!-- 拖拽分隔条 -->
|
||
<GridSplitter
|
||
Grid.Column="1"
|
||
x:Name="GridSplitter"
|
||
Width="4"
|
||
ResizeBehavior="PreviousAndNext"
|
||
ShowsPreview="True"
|
||
Cursor="SizeWE"
|
||
Background="{DynamicResource RegionBrush}"
|
||
PreviewStyle="{StaticResource GridSplitterPreviewStyle}">
|
||
<GridSplitter.Style>
|
||
<Style TargetType="GridSplitter">
|
||
<Setter Property="Visibility" Value="Visible"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding IsMenuTreePanelCollapsed}" Value="True">
|
||
<Setter Property="Visibility" Value="Collapsed"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</GridSplitter.Style>
|
||
</GridSplitter>
|
||
<!-- 主内容区域 -->
|
||
<Border
|
||
Grid.Column="2"
|
||
Background="{DynamicResource RegionBrush}"
|
||
BorderBrush="{DynamicResource BorderBrush}"
|
||
BorderThickness="1,0,0,0">
|
||
<Grid>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<hc:TabControl
|
||
ItemsSource="{Binding OpenTabs}"
|
||
SelectedItem="{Binding SelectedTab, Mode=TwoWay}"
|
||
OverflowMenuDisplayMemberPath="Header"
|
||
IsAnimationEnabled="True"
|
||
IsDraggable="True"
|
||
ShowCloseButton="True"
|
||
TabItemWidth="120"
|
||
FontSize="12"
|
||
BorderThickness="0"
|
||
Background="{DynamicResource RegionBrush}"
|
||
Visibility="{Binding AppSettingsViewModel.IsTabControlVisible, Converter={StaticResource Boolean2VisibilityConverter}}"
|
||
PreviewMouseRightButtonDown="TabControl_PreviewMouseRightButtonDown">
|
||
|
||
<!-- 定义资源 -->
|
||
<hc:TabControl.Resources>
|
||
<!-- AntDesign 模板 -->
|
||
<DataTemplate x:Key="AntDesignIconTemplate">
|
||
<TextBlock
|
||
FontFamily="{StaticResource AntDesignIcon}"
|
||
FontSize="14"
|
||
Text="{Binding Icon}"
|
||
Margin="0,0,5,0"
|
||
VerticalAlignment="Center"/>
|
||
</DataTemplate>
|
||
|
||
<!-- MaterialDesign 模板 -->
|
||
<DataTemplate x:Key="MaterialDesignIconTemplate">
|
||
<md:PackIcon
|
||
Kind="{Binding Icon}"
|
||
Width="16"
|
||
Height="16"
|
||
Margin="0,0,5,0"
|
||
VerticalAlignment="Center"/>
|
||
</DataTemplate>
|
||
|
||
<!-- FontAwesome 模板 -->
|
||
<DataTemplate x:Key="FontawesomeIconTemplate">
|
||
<ctls:FontAwesomeIcon
|
||
Icon="{Binding Icon}"
|
||
FontSize="14"
|
||
Margin="0,0,5,0"
|
||
VerticalAlignment="Center"/>
|
||
</DataTemplate>
|
||
|
||
<Style x:Key="CusTabItemPlusBaseStyle" TargetType="hc:TabItem" BasedOn="{StaticResource TabItemPlusBaseStyle}">
|
||
<Setter Property="BorderThickness" Value="0,0,1,1"/>
|
||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="hc:TabItem">
|
||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true" ContextMenu="{TemplateBinding Menu}">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="Auto" />
|
||
<ColumnDefinition />
|
||
<ColumnDefinition Width="Auto" />
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<!-- 外层边框 -->
|
||
<Border Grid.ColumnSpan="3" BorderThickness="{TemplateBinding BorderThickness}" x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Margin="0">
|
||
<Border Margin="0,0,0,-1" x:Name="innerBorder" Background="{DynamicResource RegionBrush}" Visibility="Collapsed" />
|
||
</Border>
|
||
|
||
<!-- 图标 -->
|
||
<Path x:Name="PathMain" Margin="10,0,0,0" Grid.Column="0" Width="{TemplateBinding hc:IconElement.Width}" Height="{TemplateBinding hc:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
|
||
|
||
<!-- Header 内容 -->
|
||
<ContentPresenter Grid.Column="1" x:Name="contentPresenter" ContentSource="Header" Focusable="False" HorizontalAlignment="Stretch" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" />
|
||
|
||
<!-- 遮罩 -->
|
||
<Border Name="BorderMask" Grid.Column="1" HorizontalAlignment="Right" Width="20" Background="{TemplateBinding Background}" Margin="0,0,1,1">
|
||
<Border.OpacityMask>
|
||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||
<GradientStop Color="White" Offset="1" />
|
||
<GradientStop Offset="0" />
|
||
</LinearGradientBrush>
|
||
</Border.OpacityMask>
|
||
</Border>
|
||
|
||
<!-- 关闭按钮 -->
|
||
<Button
|
||
Grid.Column="2"
|
||
Focusable="False"
|
||
Command="{Binding CloseTabCommand}"
|
||
CommandParameter="{Binding}"
|
||
Background="Transparent"
|
||
Width="28"
|
||
Visibility="{Binding IsClosable, Converter={StaticResource Boolean2VisibilityConverter}}"
|
||
OverridesDefaultStyle="True"
|
||
Cursor="Hand">
|
||
<Button.Template>
|
||
<ControlTemplate TargetType="Button">
|
||
<!-- 使用稍大的容器保证圆形和图标居中 -->
|
||
<Grid Width="28" Height="28" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="1">
|
||
<!-- 圆形 hover 背景(默认透明) -->
|
||
<Ellipse x:Name="bg"
|
||
Width="16"
|
||
Height="16"
|
||
Fill="Transparent"
|
||
HorizontalAlignment="Center"
|
||
VerticalAlignment="Center"/>
|
||
<Path x:Name="icon"
|
||
Style="{StaticResource ClosePathStyle}"
|
||
Width="8"
|
||
Height="8"
|
||
Fill="{DynamicResource PrimaryTextBrush}"
|
||
HorizontalAlignment="Center"
|
||
VerticalAlignment="Center"
|
||
SnapsToDevicePixels="True"/>
|
||
</Grid>
|
||
|
||
<ControlTemplate.Triggers>
|
||
<!-- Hover:显示圆形背景并加深图标颜色 -->
|
||
<Trigger Property="IsMouseOver" Value="True">
|
||
<Setter TargetName="bg" Property="Fill" Value="#E5E5E5"/>
|
||
<Setter TargetName="icon" Property="Fill" Value="#333"/>
|
||
</Trigger>
|
||
|
||
<!-- Pressed:背景更深 -->
|
||
<Trigger Property="IsPressed" Value="True">
|
||
<Setter TargetName="bg" Property="Fill" Value="#CCCCCC"/>
|
||
</Trigger>
|
||
|
||
<!-- Disabled 状态下淡化(可选) -->
|
||
<Trigger Property="IsEnabled" Value="False">
|
||
<Setter TargetName="icon" Property="Opacity" Value="0.4"/>
|
||
<Setter TargetName="bg" Property="Opacity" Value="0.4"/>
|
||
</Trigger>
|
||
</ControlTemplate.Triggers>
|
||
</ControlTemplate>
|
||
</Button.Template>
|
||
</Button>
|
||
</Grid>
|
||
|
||
<ControlTemplate.Triggers>
|
||
<Trigger Property="IsSelected" Value="true">
|
||
<Setter Property="Panel.ZIndex" Value="1"/>
|
||
<Setter Property="Visibility" TargetName="innerBorder" Value="Visible"/>
|
||
<Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter"/>
|
||
<Setter Property="Background" TargetName="BorderMask" Value="{DynamicResource RegionBrush}"/>
|
||
</Trigger>
|
||
|
||
<Trigger Property="hc:IconElement.Geometry" Value="{x:Null}">
|
||
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/>
|
||
</Trigger>
|
||
|
||
<Trigger Property="IsEnabled" Value="False">
|
||
<Setter Property="Opacity" Value="0.4" TargetName="contentPresenter"/>
|
||
</Trigger>
|
||
|
||
<!-- Hover 效果 -->
|
||
<Trigger Property="IsMouseOver" Value="True">
|
||
<!--<Setter Property="Background" TargetName="mainBorder" Value="{DynamicResource SecondaryRegionBrush}" />-->
|
||
<Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter"/>
|
||
</Trigger>
|
||
</ControlTemplate.Triggers>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
|
||
</hc:TabControl.Resources>
|
||
|
||
<hc:TabControl.ItemContainerStyle>
|
||
<Style TargetType="hc:TabItem" BasedOn="{StaticResource CusTabItemPlusBaseStyle}">
|
||
<Setter Property="Menu">
|
||
<Setter.Value>
|
||
<ContextMenu MinWidth="140" Padding="3,5" Background="{DynamicResource ThirdlyRegionBrush}">
|
||
<ContextMenu.ItemContainerStyle>
|
||
<Style TargetType="MenuItem">
|
||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="MenuItem">
|
||
<Border x:Name="Border" Background="{TemplateBinding Background}" CornerRadius="2" Padding="0,5">
|
||
<ContentPresenter ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
|
||
</Border>
|
||
<ControlTemplate.Triggers>
|
||
<Trigger Property="IsHighlighted" Value="True">
|
||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||
</Trigger>
|
||
<Trigger Property="IsEnabled" Value="False">
|
||
<Setter Property="Opacity" Value="0.4"/>
|
||
<Setter Property="Cursor" Value="No"/>
|
||
</Trigger>
|
||
</ControlTemplate.Triggers>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
</ContextMenu.ItemContainerStyle>
|
||
<MenuItem
|
||
Header="刷新页面"
|
||
Command="{Binding PlacementTarget.DataContext.RefreshTabCommand,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
CommandParameter="{Binding PlacementTarget.DataContext,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||
<MenuItem
|
||
Header="关闭当前"
|
||
Command="{Binding PlacementTarget.DataContext.CloseTabCommand,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
CommandParameter="{Binding PlacementTarget.DataContext,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
IsEnabled="{Binding PlacementTarget.DataContext.IsClosable, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||
<MenuItem
|
||
Header="关闭左侧"
|
||
Command="{Binding PlacementTarget.DataContext.CloseLeftTabsCommand,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
CommandParameter="{Binding PlacementTarget.DataContext,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
IsEnabled="{Binding PlacementTarget.DataContext.HasClosableLeft, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||
<MenuItem
|
||
Header="关闭右侧"
|
||
Command="{Binding PlacementTarget.DataContext.CloseRightTabsCommand,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
CommandParameter="{Binding PlacementTarget.DataContext,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
IsEnabled="{Binding PlacementTarget.DataContext.HasClosableRight, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||
<MenuItem
|
||
Header="关闭其他"
|
||
Command="{Binding PlacementTarget.DataContext.CloseOtherTabsCommand,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
CommandParameter="{Binding PlacementTarget.DataContext,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
IsEnabled="{Binding PlacementTarget.DataContext.HasClosableOther, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||
<MenuItem
|
||
Header="关闭全部"
|
||
Command="{Binding PlacementTarget.DataContext.CloseAllTabsCommand,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
CommandParameter="{Binding PlacementTarget.DataContext,
|
||
RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||
IsEnabled="{Binding PlacementTarget.DataContext.HasClosableAny, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||
</ContextMenu>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
</hc:TabControl.ItemContainerStyle>
|
||
|
||
<hc:TabControl.ItemTemplate>
|
||
<DataTemplate>
|
||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||
|
||
<!-- ContentControl:动态选择图标模板 -->
|
||
<ContentControl>
|
||
<ContentControl.Style>
|
||
<Style TargetType="ContentControl">
|
||
<!-- 默认模板(AntDesign) -->
|
||
<Setter Property="ContentTemplate" Value="{StaticResource AntDesignIconTemplate}" />
|
||
<!-- 绑定数据上下文 -->
|
||
<Setter Property="Content" Value="{Binding}" />
|
||
|
||
<!-- 触发器根据 IconType 切换模板 -->
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding IconType}" Value="{x:Static core:IconTypeEnum.MaterialDesign}">
|
||
<Setter Property="ContentTemplate" Value="{StaticResource MaterialDesignIconTemplate}" />
|
||
</DataTrigger>
|
||
<DataTrigger Binding="{Binding IconType}" Value="{x:Static core:IconTypeEnum.FontAwesome}">
|
||
<Setter Property="ContentTemplate" Value="{StaticResource FontawesomeIconTemplate}" />
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</ContentControl.Style>
|
||
</ContentControl>
|
||
|
||
<!-- 文本标题 -->
|
||
<TextBlock Text="{Binding Header}" VerticalAlignment="Center"/>
|
||
|
||
</StackPanel>
|
||
</DataTemplate>
|
||
</hc:TabControl.ItemTemplate>
|
||
|
||
<!-- 内容模板设为空(因为内容在外部显示),不能省略,不然会显示SelectedTab类型的全路径名称 -->
|
||
<hc:TabControl.ContentTemplate>
|
||
<DataTemplate/>
|
||
</hc:TabControl.ContentTemplate>
|
||
</hc:TabControl>
|
||
|
||
<!-- 内容区域 -->
|
||
<hc:TransitioningContentControl Grid.Row="1" prism:RegionManager.RegionName="{x:Static consts:CommonConst.ContentRegion}"/>
|
||
</Grid>
|
||
</Border>
|
||
</Grid>
|
||
</DockPanel>
|
||
|
||
<hc:Drawer
|
||
IsOpen="{Binding IsAppSettingsOpen}"
|
||
Dock="Left"
|
||
ShowMask="True">
|
||
<Border
|
||
Background="{DynamicResource ThirdlyRegionBrush}"
|
||
Effect="{StaticResource EffectShadow1}"
|
||
Width="220">
|
||
<Grid>
|
||
<Grid.RowDefinitions>
|
||
<!-- 内容区域 -->
|
||
<RowDefinition Height="*"/>
|
||
<!-- 按钮区域 -->
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 可滚动的内容区域 -->
|
||
<hc:ScrollViewer
|
||
x:Name="ContentScrollViewer"
|
||
IsInertiaEnabled="True"
|
||
VerticalScrollBarVisibility="Auto"
|
||
Grid.Row="0">
|
||
<StackPanel Margin="20" x:Name="ContentPanel">
|
||
<TextBlock HorizontalAlignment="Left" Text="主题设置" FontSize="16" Style="{StaticResource TextBlockTitle}"/>
|
||
<Border BorderThickness="0,0,0,1" BorderBrush="{DynamicResource ThirdlyBorderBrush}" Margin="0,10,0,20"/>
|
||
|
||
<DockPanel LastChildFill="False" Margin="0,0,0,20">
|
||
<TextBlock Text="与系统同步" DockPanel.Dock="Left"/>
|
||
<ToggleButton
|
||
IsChecked="{Binding AppSettingsViewModel.SyncWithSystem}"
|
||
Style="{StaticResource ToggleButtonSwitch}"
|
||
hc:VisualElement.HighlightBrush="{DynamicResource PrimaryBrush}"
|
||
DockPanel.Dock="Right"/>
|
||
</DockPanel>
|
||
<WrapPanel
|
||
Orientation="Horizontal"
|
||
Button.Click="OnSkinTypeChanged"
|
||
IsEnabled="{Binding AppSettingsViewModel.IsNotSyncWithSystem}">
|
||
<Button Tag="{x:Static hc:SkinType.Default}" Style="{StaticResource ButtonCustom}" Margin="0,0,8,8" ToolTip="默认主题">
|
||
<Grid>
|
||
<Border Background="White" Width="48" Height="48" CornerRadius="2" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}"/>
|
||
<ctls:FontAwesomeIcon
|
||
Icon=""
|
||
IconFamily="Solid"
|
||
FontSize="16"
|
||
Foreground="{DynamicResource SuccessBrush}"
|
||
VerticalAlignment="Center"
|
||
HorizontalAlignment="Center"
|
||
Visibility="{Binding AppSettingsViewModel.SkinType, Converter={StaticResource EnumToVisibilityConverter}, ConverterParameter={x:Static hc:SkinType.Default}}"/>
|
||
</Grid>
|
||
</Button>
|
||
<Button Tag="{x:Static hc:SkinType.Dark}" Style="{StaticResource ButtonCustom}" Margin="0,0,8,8" ToolTip="暗黑主题">
|
||
<Grid>
|
||
<Border Background="Black" Width="48" Height="48" CornerRadius="2" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}"/>
|
||
<ctls:FontAwesomeIcon
|
||
Icon=""
|
||
IconFamily="Solid"
|
||
FontSize="16"
|
||
Foreground="{DynamicResource SuccessBrush}"
|
||
VerticalAlignment="Center"
|
||
HorizontalAlignment="Center"
|
||
Visibility="{Binding AppSettingsViewModel.SkinType, Converter={StaticResource EnumToVisibilityConverter}, ConverterParameter={x:Static hc:SkinType.Dark}}"/>
|
||
</Grid>
|
||
</Button>
|
||
<Button Tag="{x:Static hc:SkinType.Violet}" Style="{StaticResource ButtonCustom}" Margin="0,0,8,8" ToolTip="紫色主题">
|
||
<Grid>
|
||
<Border Background="DarkViolet" Width="48" Height="48" CornerRadius="2" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}"/>
|
||
<ctls:FontAwesomeIcon
|
||
Icon=""
|
||
IconFamily="Solid"
|
||
FontSize="16"
|
||
Foreground="{DynamicResource SuccessBrush}"
|
||
VerticalAlignment="Center"
|
||
HorizontalAlignment="Center"
|
||
Visibility="{Binding AppSettingsViewModel.SkinType, Converter={StaticResource EnumToVisibilityConverter}, ConverterParameter={x:Static hc:SkinType.Violet}}"/>
|
||
</Grid>
|
||
</Button>
|
||
</WrapPanel>
|
||
|
||
<TextBlock HorizontalAlignment="Left" Text="布局设置" FontSize="16" Margin="0,40,0,0" Style="{StaticResource TextBlockTitle}"/>
|
||
<Border BorderThickness="0,0,0,1" BorderBrush="{DynamicResource ThirdlyBorderBrush}" Margin="0,10,0,20"/>
|
||
<DockPanel LastChildFill="False">
|
||
<TextBlock Text="显示选项卡" DockPanel.Dock="Left"/>
|
||
<ToggleButton
|
||
IsChecked="{Binding AppSettingsViewModel.IsTabControlVisible}"
|
||
Style="{StaticResource ToggleButtonSwitch}"
|
||
hc:VisualElement.HighlightBrush="{DynamicResource PrimaryBrush}"
|
||
DockPanel.Dock="Right"/>
|
||
</DockPanel>
|
||
|
||
<!-- 无滚动条时,按钮放在内容内部 -->
|
||
<Button
|
||
x:Name="InnerButton"
|
||
Grid.Row="1"
|
||
Style="{StaticResource ButtonPrimary}"
|
||
Command="{Binding ResetAppSettingsCommand}"
|
||
HorizontalAlignment="Stretch"
|
||
Margin="0,40,0,0"
|
||
Visibility="Collapsed">
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||
<md:PackIcon Kind="Refresh" Width="18" Height="18" VerticalAlignment="Center"/>
|
||
<TextBlock Text="重置" FontSize="14" Style="{StaticResource IconButtonStyle}"/>
|
||
</StackPanel>
|
||
</Button>
|
||
</StackPanel>
|
||
</hc:ScrollViewer>
|
||
|
||
<!-- 有滚动条时,按钮固定在底部 -->
|
||
<Button
|
||
x:Name="FixedButton"
|
||
Grid.Row="1"
|
||
Style="{StaticResource ButtonPrimary}"
|
||
Command="{Binding ResetAppSettingsCommand}"
|
||
HorizontalAlignment="Stretch"
|
||
Margin="20"
|
||
Visibility="Visible">
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||
<md:PackIcon Kind="Refresh" Width="18" Height="18" VerticalAlignment="Center"/>
|
||
<TextBlock Text="重置" FontSize="14" Style="{StaticResource IconButtonStyle}"/>
|
||
</StackPanel>
|
||
</Button>
|
||
</Grid>
|
||
</Border>
|
||
</hc:Drawer>
|
||
</Grid>
|
||
</hc:Window>
|