mirror of
https://github.com/jackqqq123/luban_ui_internal.git
synced 2025-11-15 13:48:24 +08:00
第一版页面设计;实现主题切换;
This commit is contained in:
61
.github/instructions/prompt.instructions.md
vendored
61
.github/instructions/prompt.instructions.md
vendored
@@ -2,4 +2,63 @@
|
||||
applyTo: '**'
|
||||
---
|
||||
- 说中文
|
||||
- 这是一个基于electron的项目管理工程,目标是让非程序员也能轻松使用luban管理配置表。
|
||||
- 这是一个基于Avalonia的项目管理工程,目标是让非程序员也能轻松使用luban管理配置表。
|
||||
|
||||
## UI设计规范
|
||||
|
||||
### 🎨 主题兼容性
|
||||
- **深色模式支持**: 所有UI元素必须在深色主题下清晰可见,具有足够的对比度
|
||||
- **浅色模式支持**: 所有UI元素必须在浅色主题下保持良好的可读性和视觉效果
|
||||
- **动态主题切换**: 使用DynamicResource绑定,支持运行时主题切换
|
||||
- **颜色资源化**: 避免硬编码颜色值,统一使用主题资源字典中的颜色定义
|
||||
|
||||
### 🎯 交互状态设计
|
||||
- **主要操作按钮**: 使用主题蓝色系,在两种模式下都要突出显示
|
||||
- **成功/确认状态**: 使用绿色系,表示积极操作
|
||||
- **警告状态**: 使用黄色系,提醒用户注意
|
||||
- **错误/删除状态**: 使用红色系,表示危险操作
|
||||
- **悬停和按下状态**: 提供清晰的视觉反馈,确保在两种主题下都有足够的对比度
|
||||
|
||||
### 📝 文字层级
|
||||
- **主要文字**: 使用主题的主要文字颜色,确保最佳可读性
|
||||
- **次要文字**: 使用稍浅的颜色,但仍保持良好的可读性
|
||||
- **占位符文字**: 使用更浅的颜色,明确区分占位符和实际内容
|
||||
- **禁用文字**: 使用最浅的颜色,明确表示不可用状态
|
||||
|
||||
### 🔘 圆角规范
|
||||
- **按钮圆角**: `4px`
|
||||
- **输入框圆角**: `4px`
|
||||
- **卡片圆角**: `5px`
|
||||
- **列表项圆角**: `3px`
|
||||
|
||||
### 📏 间距规范
|
||||
- **小间距**: `5px`
|
||||
- **标准间距**: `10px`
|
||||
- **中等间距**: `15px`
|
||||
- **大间距**: `20px`
|
||||
- **页面边距**: `20px`
|
||||
- **按钮内边距**: 水平`15px` 垂直`8px`
|
||||
- **导航按钮内边距**: 水平`20px` 垂直`15px`
|
||||
|
||||
### 🎭 动画规范
|
||||
- **过渡时间**: `0.2s` (200ms)
|
||||
- **缓动函数**: `ease-out`
|
||||
- **支持的过渡**: 背景色、前景色、透明度
|
||||
|
||||
### 📱 组件规范
|
||||
- **导航栏宽度**: `200px`
|
||||
- **最小窗口尺寸**: 宽度`1000px` 高度`600px`
|
||||
- **设计尺寸**: 宽度`1200px` 高度`800px`
|
||||
- **按钮最小高度**: `36px`
|
||||
- **输入框最小高度**: `32px`
|
||||
|
||||
### 🎪 图标使用
|
||||
- 使用Emoji作为图标: 📚📁📦📱⚙️🎮📊🔧🤖➕🔄📂🌐等
|
||||
- 图标大小: 导航按钮中正常大小,卡片中`40px`
|
||||
|
||||
### 🖱️ 交互反馈
|
||||
- 所有可点击元素必须有悬停状态
|
||||
- 按钮支持按下状态反馈
|
||||
- 输入框支持焦点状态
|
||||
- 列表项支持选中和悬停状态
|
||||
- 过渡动画让交互更流畅
|
||||
17
design/页面设计.md
Normal file
17
design/页面设计.md
Normal file
@@ -0,0 +1,17 @@
|
||||
这是我的应用主页设计,
|
||||
左侧按钮依次为知识库、项目、安装
|
||||
左侧最下方是设置按钮
|
||||
|
||||
- 点击知识库右侧内容区:
|
||||
- 左侧,第一行为新建会话,下面是历史会话记录
|
||||
- 右侧,没有内容时显示问答窗口,可以切换AI模型,有内容时显示会话内容
|
||||
- 点击项目管理右侧内容区:
|
||||
- 顶部,导入项目、新建项目
|
||||
- 下方,项目列表
|
||||
- 点击安装鲁班右侧内容区:
|
||||
- 顶部,添加本地版本,在线安装
|
||||
- 下方,鲁班版本列表
|
||||
- 点击设置,右侧内容区:
|
||||
- 下载目录,用于存放下载资源
|
||||
- 主体颜色,亮色、深色跟随系统
|
||||
|
||||
@@ -6,5 +6,8 @@
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
|
||||
<!-- 引入自定义样式 -->
|
||||
<StyleInclude Source="/Themes/Styles.axaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -1,6 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using System;
|
||||
|
||||
namespace LubanHub.App;
|
||||
|
||||
@@ -8,16 +9,39 @@ public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
try
|
||||
{
|
||||
Console.WriteLine("正在初始化应用程序...");
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
Console.WriteLine("XAML加载完成。");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"初始化时发生错误: {ex.Message}");
|
||||
Console.WriteLine($"详细错误信息: {ex}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
try
|
||||
{
|
||||
desktop.MainWindow = new MainWindow();
|
||||
}
|
||||
Console.WriteLine("框架初始化完成,正在创建主窗口...");
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = new MainWindow();
|
||||
Console.WriteLine("主窗口已创建。");
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
Console.WriteLine("应用程序启动完成。");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"框架初始化完成时发生错误: {ex.Message}");
|
||||
Console.WriteLine($"详细错误信息: {ex}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,262 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
|
||||
x:Class="LubanHub.App.MainWindow"
|
||||
Title="LubanHub">
|
||||
Welcome to Avalonia!
|
||||
Title="LubanHub"
|
||||
MinWidth="1000" MinHeight="600">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧导航栏 -->
|
||||
<Border Grid.Column="0" Background="{DynamicResource SidebarBackgroundBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,1,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 应用标题 -->
|
||||
<TextBlock Grid.Row="0" Text="LubanHub"
|
||||
Classes="subheader"
|
||||
Margin="{DynamicResource LargeMargin}"
|
||||
HorizontalAlignment="Center"/>
|
||||
|
||||
<!-- 导航按钮区域 -->
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical">
|
||||
<Button Name="KnowledgeButton"
|
||||
Content="📚 知识库"
|
||||
Classes="navigation-button"
|
||||
Click="OnKnowledgeButtonClick"/>
|
||||
<Button Name="ProjectButton"
|
||||
Content="📁 项目"
|
||||
Classes="navigation-button"
|
||||
Click="OnProjectButtonClick"/>
|
||||
<Button Name="InstallButton"
|
||||
Content="📦 安装"
|
||||
Classes="navigation-button"
|
||||
Click="OnInstallButtonClick"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 底部按钮区域 -->
|
||||
<StackPanel Grid.Row="2" Orientation="Vertical">
|
||||
<!-- 设置按钮 -->
|
||||
<Button Name="SettingsButton"
|
||||
Content="⚙️ 设置"
|
||||
Classes="navigation-button"
|
||||
Margin="{DynamicResource StandardMargin}"
|
||||
Click="OnSettingsButtonClick"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 右侧内容区域 -->
|
||||
<Border Grid.Column="1" Background="{DynamicResource AppBackgroundBrush}">
|
||||
<Grid>
|
||||
<!-- 内容区域 -->
|
||||
<Panel Name="ContentPanel">
|
||||
<!-- 默认欢迎页面 -->
|
||||
<StackPanel Name="WelcomePanel"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="欢迎使用 LubanHub"
|
||||
Classes="header"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="{DynamicResource LargeMargin}"/>
|
||||
<TextBlock Text="请选择左侧菜单开始使用"
|
||||
Classes="body"
|
||||
Foreground="{DynamicResource SecondaryTextBrush}"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 知识库页面 -->
|
||||
<Grid Name="KnowledgePanel" IsVisible="False">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧会话列表 -->
|
||||
<Border Grid.Column="0" Background="{DynamicResource PanelBackgroundBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,1,0">
|
||||
<StackPanel Margin="{DynamicResource StandardMargin}">
|
||||
<Button Content="+ 新建会话"
|
||||
Classes="primary"
|
||||
Margin="{DynamicResource StandardMargin}"/>
|
||||
<TextBlock Text="历史会话"
|
||||
Classes="caption"
|
||||
Margin="{DynamicResource StandardMargin}"/>
|
||||
<ListBox Background="Transparent"
|
||||
BorderThickness="0">
|
||||
<ListBoxItem Content="会话 1"/>
|
||||
<ListBoxItem Content="会话 2"/>
|
||||
<ListBoxItem Content="会话 3"/>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 右侧聊天区域 -->
|
||||
<Grid Grid.Column="1">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="🤖 AI助手"
|
||||
Classes="subheader"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="{DynamicResource StandardMargin}"/>
|
||||
<ComboBox SelectedIndex="0" Width="150" Margin="{DynamicResource LargeMargin}">
|
||||
<ComboBoxItem Content="GPT-4"/>
|
||||
<ComboBoxItem Content="Claude"/>
|
||||
<ComboBoxItem Content="文心一言"/>
|
||||
</ComboBox>
|
||||
<TextBox Watermark="请输入您的问题..."
|
||||
Width="400"
|
||||
Height="100"
|
||||
TextWrapping="Wrap"
|
||||
AcceptsReturn="True"/>
|
||||
<Button Content="发送"
|
||||
Classes="primary"
|
||||
Margin="{DynamicResource StandardMargin}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- 项目页面 -->
|
||||
<Grid Name="ProjectPanel" IsVisible="False">
|
||||
<StackPanel Margin="20">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
|
||||
<Button Content="📂 导入项目"
|
||||
Background="#007ACC"
|
||||
Foreground="White"
|
||||
Margin="0,0,10,0"
|
||||
Padding="10,5"/>
|
||||
<Button Content="➕ 新建项目"
|
||||
Background="#28A745"
|
||||
Foreground="White"
|
||||
Padding="10,5"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="项目列表"
|
||||
Foreground="White"
|
||||
FontSize="16"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<ListBox Background="#252526"
|
||||
BorderThickness="1"
|
||||
BorderBrush="#3F3F46">
|
||||
<ListBoxItem>
|
||||
<StackPanel>
|
||||
<TextBlock Text="示例项目 1" Foreground="White" FontWeight="Bold"/>
|
||||
<TextBlock Text="项目描述..." Foreground="#CCCCCC" FontSize="12"/>
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem>
|
||||
<StackPanel>
|
||||
<TextBlock Text="示例项目 2" Foreground="White" FontWeight="Bold"/>
|
||||
<TextBlock Text="项目描述..." Foreground="#CCCCCC" FontSize="12"/>
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 安装页面 -->
|
||||
<Grid Name="InstallPanel" IsVisible="False">
|
||||
<StackPanel Margin="20">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
|
||||
<Button Content="📁 添加本地版本"
|
||||
Background="#007ACC"
|
||||
Foreground="White"
|
||||
Margin="0,0,10,0"
|
||||
Padding="10,5"/>
|
||||
<Button Content="🌐 在线安装"
|
||||
Background="#28A745"
|
||||
Foreground="White"
|
||||
Padding="10,5"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="鲁班版本列表"
|
||||
Foreground="White"
|
||||
FontSize="16"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<ListBox Background="#252526"
|
||||
BorderThickness="1"
|
||||
BorderBrush="#3F3F46">
|
||||
<ListBoxItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Luban v2.1.0" Foreground="White" FontWeight="Bold" Width="150"/>
|
||||
<TextBlock Text="已安装" Foreground="#28A745" Margin="10,0"/>
|
||||
<Button Content="启动" Background="#007ACC" Foreground="White" Padding="5,2"/>
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Luban v2.0.5" Foreground="White" FontWeight="Bold" Width="150"/>
|
||||
<TextBlock Text="未安装" Foreground="#DC3545" Margin="10,0"/>
|
||||
<Button Content="安装" Background="#28A745" Foreground="White" Padding="5,2"/>
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 设置页面 -->
|
||||
<Grid Name="SettingsPanel" IsVisible="False">
|
||||
<StackPanel Margin="{DynamicResource LargeMargin}">
|
||||
<TextBlock Text="⚙️ 设置"
|
||||
Classes="subheader"
|
||||
Foreground="{DynamicResource PrimaryTextBrush}"
|
||||
FontSize="20"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
<StackPanel Margin="0,0,0,20">
|
||||
<TextBlock Text="下载目录"
|
||||
Classes="title"
|
||||
Foreground="{DynamicResource PrimaryTextBrush}"
|
||||
FontSize="14"
|
||||
Margin="0,0,0,5"/>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Column="0"
|
||||
Text="C:\Users\Downloads\LubanHub"
|
||||
Background="{DynamicResource InputBackgroundBrush}"
|
||||
Foreground="{DynamicResource PrimaryTextBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}"
|
||||
Margin="0,0,10,0"/>
|
||||
<Button Grid.Column="1"
|
||||
Content="浏览..."
|
||||
Classes="primary"
|
||||
Padding="{DynamicResource ButtonPadding}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock Text="主题设置"
|
||||
Classes="title"
|
||||
Foreground="{DynamicResource PrimaryTextBrush}"
|
||||
FontSize="14"
|
||||
Margin="0,0,0,5"/>
|
||||
<ComboBox Name="ThemeComboBox"
|
||||
SelectedIndex="0"
|
||||
Width="200"
|
||||
HorizontalAlignment="Left"
|
||||
SelectionChanged="OnThemeComboBoxSelectionChanged">
|
||||
<ComboBoxItem Content="深色主题"/>
|
||||
<ComboBoxItem Content="浅色主题"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Panel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,11 +1,133 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Controls.Selection;
|
||||
using LubanHub.App.Services;
|
||||
|
||||
namespace LubanHub.App;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private Panel? _contentPanel;
|
||||
private StackPanel? _welcomePanel;
|
||||
private Grid? _knowledgePanel;
|
||||
private Grid? _projectPanel;
|
||||
private Grid? _installPanel;
|
||||
private Grid? _settingsPanel;
|
||||
|
||||
private Button? _knowledgeButton;
|
||||
private Button? _projectButton;
|
||||
private Button? _installButton;
|
||||
private Button? _settingsButton;
|
||||
private ComboBox? _themeComboBox;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeComponents();
|
||||
|
||||
// 订阅主题变化事件
|
||||
ThemeManager.ThemeChanged += OnThemeChanged;
|
||||
|
||||
// 初始化主题
|
||||
ThemeManager.Initialize();
|
||||
UpdateThemeComboBox();
|
||||
}
|
||||
|
||||
private void InitializeComponents()
|
||||
{
|
||||
// 获取面板引用
|
||||
_contentPanel = this.FindControl<Panel>("ContentPanel");
|
||||
_welcomePanel = this.FindControl<StackPanel>("WelcomePanel");
|
||||
_knowledgePanel = this.FindControl<Grid>("KnowledgePanel");
|
||||
_projectPanel = this.FindControl<Grid>("ProjectPanel");
|
||||
_installPanel = this.FindControl<Grid>("InstallPanel");
|
||||
_settingsPanel = this.FindControl<Grid>("SettingsPanel");
|
||||
|
||||
// 获取按钮引用
|
||||
_knowledgeButton = this.FindControl<Button>("KnowledgeButton");
|
||||
_projectButton = this.FindControl<Button>("ProjectButton");
|
||||
_installButton = this.FindControl<Button>("InstallButton");
|
||||
_settingsButton = this.FindControl<Button>("SettingsButton");
|
||||
_themeComboBox = this.FindControl<ComboBox>("ThemeComboBox");
|
||||
}
|
||||
|
||||
private void ShowPanel(Grid? targetPanel)
|
||||
{
|
||||
// 隐藏所有面板
|
||||
if (_welcomePanel != null) _welcomePanel.IsVisible = false;
|
||||
if (_knowledgePanel != null) _knowledgePanel.IsVisible = false;
|
||||
if (_projectPanel != null) _projectPanel.IsVisible = false;
|
||||
if (_installPanel != null) _installPanel.IsVisible = false;
|
||||
if (_settingsPanel != null) _settingsPanel.IsVisible = false;
|
||||
|
||||
// 显示目标面板
|
||||
if (targetPanel != null)
|
||||
{
|
||||
targetPanel.IsVisible = true;
|
||||
}
|
||||
|
||||
// 更新按钮样式
|
||||
UpdateButtonStyles();
|
||||
}
|
||||
|
||||
private void UpdateButtonStyles()
|
||||
{
|
||||
// 移除所有按钮的选中样式
|
||||
_knowledgeButton?.Classes.Remove("selected");
|
||||
_projectButton?.Classes.Remove("selected");
|
||||
_installButton?.Classes.Remove("selected");
|
||||
_settingsButton?.Classes.Remove("selected");
|
||||
|
||||
// 根据当前显示的面板添加选中样式
|
||||
if (_knowledgePanel?.IsVisible == true)
|
||||
_knowledgeButton?.Classes.Add("selected");
|
||||
else if (_projectPanel?.IsVisible == true)
|
||||
_projectButton?.Classes.Add("selected");
|
||||
else if (_installPanel?.IsVisible == true)
|
||||
_installButton?.Classes.Add("selected");
|
||||
else if (_settingsPanel?.IsVisible == true)
|
||||
_settingsButton?.Classes.Add("selected");
|
||||
}
|
||||
|
||||
private void OnKnowledgeButtonClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(_knowledgePanel);
|
||||
}
|
||||
|
||||
private void OnProjectButtonClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(_projectPanel);
|
||||
}
|
||||
|
||||
private void OnInstallButtonClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(_installPanel);
|
||||
}
|
||||
|
||||
private void OnSettingsButtonClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowPanel(_settingsPanel);
|
||||
}
|
||||
|
||||
private void OnThemeComboBoxSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (_themeComboBox?.SelectedIndex != null)
|
||||
{
|
||||
var newTheme = _themeComboBox.SelectedIndex == 0 ? ThemeVariant.Dark : ThemeVariant.Light;
|
||||
ThemeManager.SetTheme(newTheme);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThemeChanged(ThemeVariant theme)
|
||||
{
|
||||
UpdateThemeComboBox();
|
||||
}
|
||||
|
||||
private void UpdateThemeComboBox()
|
||||
{
|
||||
if (_themeComboBox != null)
|
||||
{
|
||||
_themeComboBox.SelectedIndex = ThemeManager.CurrentTheme == ThemeVariant.Dark ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace LubanHub.App;
|
||||
|
||||
@@ -9,8 +10,24 @@ class Program
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.File.WriteAllText("debug.log", "正在启动应用程序...\n");
|
||||
var app = BuildAvaloniaApp();
|
||||
System.IO.File.AppendAllText("debug.log", "AppBuilder创建完成,正在启动...\n");
|
||||
app.StartWithClassicDesktopLifetime(args);
|
||||
System.IO.File.AppendAllText("debug.log", "应用程序启动完成。\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorMsg = $"启动应用程序时发生错误: {ex.Message}\n详细错误信息: {ex}\n";
|
||||
System.IO.File.WriteAllText("error.log", errorMsg);
|
||||
Console.WriteLine(errorMsg);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
|
||||
71
src/LubanHub.App/Services/ThemeManager.cs
Normal file
71
src/LubanHub.App/Services/ThemeManager.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace LubanHub.App.Services
|
||||
{
|
||||
public enum ThemeVariant
|
||||
{
|
||||
Dark,
|
||||
Light
|
||||
}
|
||||
|
||||
public static class ThemeManager
|
||||
{
|
||||
private static ThemeVariant _currentTheme = ThemeVariant.Dark;
|
||||
|
||||
public static ThemeVariant CurrentTheme => _currentTheme;
|
||||
|
||||
public static event Action<ThemeVariant>? ThemeChanged;
|
||||
|
||||
public static void SetTheme(ThemeVariant theme)
|
||||
{
|
||||
if (_currentTheme == theme)
|
||||
return;
|
||||
|
||||
_currentTheme = theme;
|
||||
ApplyTheme(theme);
|
||||
ThemeChanged?.Invoke(theme);
|
||||
}
|
||||
|
||||
public static void ToggleTheme()
|
||||
{
|
||||
var newTheme = _currentTheme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
||||
SetTheme(newTheme);
|
||||
}
|
||||
|
||||
private static void ApplyTheme(ThemeVariant theme)
|
||||
{
|
||||
var app = Application.Current;
|
||||
if (app?.Resources == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
// 加载对应的主题资源字典
|
||||
var themeFile = theme == ThemeVariant.Dark ? "DarkTheme.axaml" : "LightTheme.axaml";
|
||||
var uri = new Uri($"avares://LubanHub.App/Themes/{themeFile}");
|
||||
|
||||
// 使用AvaloniaXamlLoader加载资源字典
|
||||
var themeDict = AvaloniaXamlLoader.Load(uri) as ResourceDictionary;
|
||||
if (themeDict != null)
|
||||
{
|
||||
// 清除现有的合并字典
|
||||
app.Resources.MergedDictionaries.Clear();
|
||||
// 添加新的主题字典
|
||||
app.Resources.MergedDictionaries.Add(themeDict);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"主题切换失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
// 初始化时应用默认主题
|
||||
ApplyTheme(_currentTheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
72
src/LubanHub.App/Themes/DarkTheme.axaml
Normal file
72
src/LubanHub.App/Themes/DarkTheme.axaml
Normal file
@@ -0,0 +1,72 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<!-- 深色主题配色表 -->
|
||||
|
||||
<!-- 基础背景色 -->
|
||||
<SolidColorBrush x:Key="AppBackgroundBrush">#1E1E1E</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="SidebarBackgroundBrush">#2D2D30</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PanelBackgroundBrush">#252526</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="InputBackgroundBrush">#3C3C3C</SolidColorBrush>
|
||||
|
||||
<!-- 边框和分割线 -->
|
||||
<SolidColorBrush x:Key="BorderBrush">#3F3F46</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DividerBrush">#555555</SolidColorBrush>
|
||||
|
||||
<!-- 文字颜色 -->
|
||||
<SolidColorBrush x:Key="PrimaryTextBrush">#FFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="SecondaryTextBrush">#CCCCCC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PlaceholderTextBrush">#999999</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DisabledTextBrush">#666666</SolidColorBrush>
|
||||
|
||||
<!-- 交互状态颜色 -->
|
||||
<SolidColorBrush x:Key="PrimaryBrush">#007ACC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PrimaryHoverBrush">#1E8AD6</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="SuccessBrush">#28A745</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="WarningBrush">#FFC107</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ErrorBrush">#DC3545</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="HoverBrush">#4A4A4A</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PressedBrush">#5A5A5A</SolidColorBrush>
|
||||
|
||||
<!-- 导航相关 -->
|
||||
<SolidColorBrush x:Key="NavigationBackgroundBrush">Transparent</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationTextBrush">#CCCCCC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationHoverBrush">#4A4A4A</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationHoverTextBrush">#FFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationSelectedBrush">#007ACC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationSelectedHoverBrush">#1E8AD6</SolidColorBrush>
|
||||
|
||||
<!-- 列表和卡片 -->
|
||||
<SolidColorBrush x:Key="ListItemHoverBrush">#4A4A4A</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ListItemSelectedBrush">#007ACC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="CardBackgroundBrush">#252526</SolidColorBrush>
|
||||
|
||||
<!-- 阴影和层级 -->
|
||||
<SolidColorBrush x:Key="ShadowBrush">#000000</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="OverlayBrush">#80000000</SolidColorBrush>
|
||||
|
||||
<!-- 圆角值 -->
|
||||
<CornerRadius x:Key="ButtonCornerRadius">4</CornerRadius>
|
||||
<CornerRadius x:Key="InputCornerRadius">4</CornerRadius>
|
||||
<CornerRadius x:Key="CardCornerRadius">5</CornerRadius>
|
||||
<CornerRadius x:Key="ListItemCornerRadius">3</CornerRadius>
|
||||
|
||||
<!-- 间距值 -->
|
||||
<Thickness x:Key="SmallMargin">5</Thickness>
|
||||
<Thickness x:Key="StandardMargin">10</Thickness>
|
||||
<Thickness x:Key="MediumMargin">15</Thickness>
|
||||
<Thickness x:Key="LargeMargin">20</Thickness>
|
||||
<Thickness x:Key="ButtonPadding">15,8</Thickness>
|
||||
<Thickness x:Key="NavigationButtonPadding">20,15</Thickness>
|
||||
<Thickness x:Key="InputPadding">8,6</Thickness>
|
||||
<Thickness x:Key="ListItemPadding">12,8</Thickness>
|
||||
|
||||
<!-- 字体大小 -->
|
||||
<x:Double x:Key="HeaderFontSize">24</x:Double>
|
||||
<x:Double x:Key="SubHeaderFontSize">20</x:Double>
|
||||
<x:Double x:Key="TitleFontSize">16</x:Double>
|
||||
<x:Double x:Key="BodyFontSize">14</x:Double>
|
||||
<x:Double x:Key="CaptionFontSize">12</x:Double>
|
||||
<x:Double x:Key="IconFontSize">40</x:Double>
|
||||
|
||||
</ResourceDictionary>
|
||||
72
src/LubanHub.App/Themes/LightTheme.axaml
Normal file
72
src/LubanHub.App/Themes/LightTheme.axaml
Normal file
@@ -0,0 +1,72 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<!-- 浅色主题配色表 -->
|
||||
|
||||
<!-- 基础背景色 -->
|
||||
<SolidColorBrush x:Key="AppBackgroundBrush">#FFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="SidebarBackgroundBrush">#F8F9FA</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PanelBackgroundBrush">#FFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="InputBackgroundBrush">#FFFFFF</SolidColorBrush>
|
||||
|
||||
<!-- 边框和分割线 -->
|
||||
<SolidColorBrush x:Key="BorderBrush">#E1E5E9</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DividerBrush">#DEE2E6</SolidColorBrush>
|
||||
|
||||
<!-- 文字颜色 -->
|
||||
<SolidColorBrush x:Key="PrimaryTextBrush">#212529</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="SecondaryTextBrush">#6C757D</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PlaceholderTextBrush">#ADB5BD</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DisabledTextBrush">#CED4DA</SolidColorBrush>
|
||||
|
||||
<!-- 交互状态颜色 -->
|
||||
<SolidColorBrush x:Key="PrimaryBrush">#007ACC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PrimaryHoverBrush">#005A9B</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="SuccessBrush">#28A745</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="WarningBrush">#FFC107</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ErrorBrush">#DC3545</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="HoverBrush">#F8F9FA</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PressedBrush">#E9ECEF</SolidColorBrush>
|
||||
|
||||
<!-- 导航相关 -->
|
||||
<SolidColorBrush x:Key="NavigationBackgroundBrush">Transparent</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationTextBrush">#6C757D</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationHoverBrush">#F8F9FA</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationHoverTextBrush">#212529</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationSelectedBrush">#007ACC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="NavigationSelectedHoverBrush">#005A9B</SolidColorBrush>
|
||||
|
||||
<!-- 列表和卡片 -->
|
||||
<SolidColorBrush x:Key="ListItemHoverBrush">#F8F9FA</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ListItemSelectedBrush">#007ACC</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="CardBackgroundBrush">#FFFFFF</SolidColorBrush>
|
||||
|
||||
<!-- 阴影和层级 -->
|
||||
<SolidColorBrush x:Key="ShadowBrush">#00000020</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="OverlayBrush">#80FFFFFF</SolidColorBrush>
|
||||
|
||||
<!-- 圆角值 -->
|
||||
<CornerRadius x:Key="ButtonCornerRadius">4</CornerRadius>
|
||||
<CornerRadius x:Key="InputCornerRadius">4</CornerRadius>
|
||||
<CornerRadius x:Key="CardCornerRadius">5</CornerRadius>
|
||||
<CornerRadius x:Key="ListItemCornerRadius">3</CornerRadius>
|
||||
|
||||
<!-- 间距值 -->
|
||||
<Thickness x:Key="SmallMargin">5</Thickness>
|
||||
<Thickness x:Key="StandardMargin">10</Thickness>
|
||||
<Thickness x:Key="MediumMargin">15</Thickness>
|
||||
<Thickness x:Key="LargeMargin">20</Thickness>
|
||||
<Thickness x:Key="ButtonPadding">15,8</Thickness>
|
||||
<Thickness x:Key="NavigationButtonPadding">20,15</Thickness>
|
||||
<Thickness x:Key="InputPadding">8,6</Thickness>
|
||||
<Thickness x:Key="ListItemPadding">12,8</Thickness>
|
||||
|
||||
<!-- 字体大小 -->
|
||||
<x:Double x:Key="HeaderFontSize">24</x:Double>
|
||||
<x:Double x:Key="SubHeaderFontSize">20</x:Double>
|
||||
<x:Double x:Key="TitleFontSize">16</x:Double>
|
||||
<x:Double x:Key="BodyFontSize">14</x:Double>
|
||||
<x:Double x:Key="CaptionFontSize">12</x:Double>
|
||||
<x:Double x:Key="IconFontSize">40</x:Double>
|
||||
|
||||
</ResourceDictionary>
|
||||
249
src/LubanHub.App/Themes/Styles.axaml
Normal file
249
src/LubanHub.App/Themes/Styles.axaml
Normal file
@@ -0,0 +1,249 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Styles.Resources>
|
||||
<!-- 圆角值 -->
|
||||
<CornerRadius x:Key="ButtonCornerRadius">4</CornerRadius>
|
||||
<CornerRadius x:Key="InputCornerRadius">4</CornerRadius>
|
||||
<CornerRadius x:Key="CardCornerRadius">5</CornerRadius>
|
||||
<CornerRadius x:Key="ListItemCornerRadius">3</CornerRadius>
|
||||
|
||||
<!-- 间距值 -->
|
||||
<Thickness x:Key="SmallMargin">5</Thickness>
|
||||
<Thickness x:Key="StandardMargin">10</Thickness>
|
||||
<Thickness x:Key="MediumMargin">15</Thickness>
|
||||
<Thickness x:Key="LargeMargin">20</Thickness>
|
||||
<Thickness x:Key="ButtonPadding">15,8</Thickness>
|
||||
<Thickness x:Key="NavigationButtonPadding">20,15</Thickness>
|
||||
<Thickness x:Key="InputPadding">8,6</Thickness>
|
||||
<Thickness x:Key="ListItemPadding">12,8</Thickness>
|
||||
|
||||
<!-- 字体大小 -->
|
||||
<x:Double x:Key="HeaderFontSize">24</x:Double>
|
||||
<x:Double x:Key="SubHeaderFontSize">20</x:Double>
|
||||
<x:Double x:Key="TitleFontSize">16</x:Double>
|
||||
<x:Double x:Key="BodyFontSize">14</x:Double>
|
||||
<x:Double x:Key="CaptionFontSize">12</x:Double>
|
||||
<x:Double x:Key="IconFontSize">40</x:Double>
|
||||
</Styles.Resources>
|
||||
|
||||
<!-- 导航按钮样式 -->
|
||||
<Style Selector="Button.navigation-button">
|
||||
<Setter Property="Background" Value="{DynamicResource NavigationBackgroundBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource NavigationTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource NavigationButtonPadding}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||
<Setter Property="FontSize" Value="{DynamicResource BodyFontSize}"/>
|
||||
<Setter Property="Margin" Value="0,2"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}"/>
|
||||
<Setter Property="Transitions">
|
||||
<Transitions>
|
||||
<BrushTransition Property="Background" Duration="0:0:0.2"/>
|
||||
<BrushTransition Property="Foreground" Duration="0:0:0.2"/>
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 导航按钮悬停状态 -->
|
||||
<Style Selector="Button.navigation-button:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource NavigationHoverBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource NavigationHoverTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 导航按钮按下状态 -->
|
||||
<Style Selector="Button.navigation-button:pressed">
|
||||
<Setter Property="Background" Value="{DynamicResource PressedBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 导航按钮选中状态 -->
|
||||
<Style Selector="Button.navigation-button.selected">
|
||||
<Setter Property="Background" Value="{DynamicResource NavigationSelectedBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 导航按钮选中状态悬停 -->
|
||||
<Style Selector="Button.navigation-button.selected:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource NavigationSelectedHoverBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 主要按钮样式 -->
|
||||
<Style Selector="Button.primary">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource ButtonPadding}"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}"/>
|
||||
<Setter Property="FontSize" Value="{DynamicResource BodyFontSize}"/>
|
||||
<Setter Property="Transitions">
|
||||
<Transitions>
|
||||
<BrushTransition Property="Background" Duration="0:0:0.2"/>
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.primary:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryHoverBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 成功按钮样式 -->
|
||||
<Style Selector="Button.success">
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource ButtonPadding}"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}"/>
|
||||
<Setter Property="FontSize" Value="{DynamicResource BodyFontSize}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 危险按钮样式 -->
|
||||
<Style Selector="Button.danger">
|
||||
<Setter Property="Background" Value="{DynamicResource ErrorBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource ButtonPadding}"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}"/>
|
||||
<Setter Property="FontSize" Value="{DynamicResource BodyFontSize}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 文本框样式 -->
|
||||
<Style Selector="TextBox">
|
||||
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource InputCornerRadius}"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource InputPadding}"/>
|
||||
<Setter Property="FontSize" Value="{DynamicResource BodyFontSize}"/>
|
||||
<Setter Property="Transitions">
|
||||
<Transitions>
|
||||
<BrushTransition Property="BorderBrush" Duration="0:0:0.1"/>
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBox:focus">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBox:pointerover">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DividerBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉框样式 -->
|
||||
<Style Selector="ComboBox">
|
||||
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource InputCornerRadius}"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource InputPadding}"/>
|
||||
<Setter Property="FontSize" Value="{DynamicResource BodyFontSize}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ComboBox:focus">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ComboBox:pointerover">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DividerBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉框项目样式 -->
|
||||
<Style Selector="ComboBoxItem">
|
||||
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource InputPadding}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ComboBoxItem:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ComboBoxItem:selected">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 列表框样式 -->
|
||||
<Style Selector="ListBox">
|
||||
<Setter Property="Background" Value="{DynamicResource PanelBackgroundBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource CardCornerRadius}"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource ListItemPadding}"/>
|
||||
<Setter Property="Margin" Value="2"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ListItemCornerRadius}"/>
|
||||
<Setter Property="Transitions">
|
||||
<Transitions>
|
||||
<BrushTransition Property="Background" Duration="0:0:0.1"/>
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ListBoxItem:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource ListItemHoverBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ListBoxItem:selected">
|
||||
<Setter Property="Background" Value="{DynamicResource ListItemSelectedBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 标题文字样式 -->
|
||||
<Style Selector="TextBlock.header">
|
||||
<Setter Property="FontSize" Value="{DynamicResource HeaderFontSize}"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.subheader">
|
||||
<Setter Property="FontSize" Value="{DynamicResource SubHeaderFontSize}"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.title">
|
||||
<Setter Property="FontSize" Value="{DynamicResource TitleFontSize}"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.body">
|
||||
<Setter Property="FontSize" Value="{DynamicResource BodyFontSize}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.caption">
|
||||
<Setter Property="FontSize" Value="{DynamicResource CaptionFontSize}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.icon">
|
||||
<Setter Property="FontSize" Value="{DynamicResource IconFontSize}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 卡片样式 -->
|
||||
<Style Selector="Border.card">
|
||||
<Setter Property="Background" Value="{DynamicResource CardBackgroundBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource CardCornerRadius}"/>
|
||||
<Setter Property="Padding" Value="{DynamicResource StandardMargin}"/>
|
||||
</Style>
|
||||
|
||||
<!-- 分割线样式 -->
|
||||
<Style Selector="Border.divider">
|
||||
<Setter Property="Background" Value="{DynamicResource DividerBrush}"/>
|
||||
<Setter Property="Height" Value="1"/>
|
||||
<Setter Property="Margin" Value="{DynamicResource StandardMargin}"/>
|
||||
</Style>
|
||||
|
||||
</Styles>
|
||||
Reference in New Issue
Block a user