FluentWPF 项目教程

FluentWPF 项目教程

FluentWPFFluent Design System for WPF.项目地址:https://gitcode.com/gh_mirrors/fl/FluentWPF

1、项目的目录结构及介绍

FluentWPF 项目的目录结构如下:

FluentWPF/
├── FluentWPF/
│   ├── Assets/
│   ├── Converters/
│   ├── Themes/
│   ├── FluentWPF.csproj
│   ├── AcrylicBrush.cs
│   ├── AcrylicWindow.cs
│   ├── RevealBackgroundBrush.cs
│   ├── RevealBorderBrush.cs
│   ├── ResourceDictionaryEx.cs
│   ├── SystemTheme.cs
│   ├── ThemeManager.cs
│   └── ...
├── Samples/
│   ├── AcrylicWindowSample/
│   ├── RevealSample/
│   ├── ParallaxSample/
│   └── ...
├── .gitignore
├── FluentWPF.sln
├── README.md
└── ...

目录结构介绍

  • FluentWPF/: 包含 FluentWPF 库的核心代码。

    • Assets/: 包含项目所需的资源文件,如图片等。
    • Converters/: 包含用于数据转换的类。
    • Themes/: 包含项目的主题资源文件。
    • FluentWPF.csproj: 项目的 C# 项目文件。
    • AcrylicBrush.cs: 实现亚克力效果的画刷类。
    • AcrylicWindow.cs: 实现亚克力效果的窗口类。
    • RevealBackgroundBrush.cs: 实现 Reveal 背景效果的画刷类。
    • RevealBorderBrush.cs: 实现 Reveal 边框效果的画刷类。
    • ResourceDictionaryEx.cs: 扩展资源字典类。
    • SystemTheme.cs: 系统主题类。
    • ThemeManager.cs: 主题管理类。
    • ...: 其他辅助类和文件。
  • Samples/: 包含示例项目,展示如何使用 FluentWPF 库。

    • AcrylicWindowSample/: 亚克力窗口示例。
    • RevealSample/: Reveal 效果示例。
    • ParallaxSample/: 视差滚动效果示例。
    • ...: 其他示例项目。
  • .gitignore: Git 忽略文件配置。

  • FluentWPF.sln: 解决方案文件。

  • README.md: 项目说明文档。

  • ...: 其他辅助文件。

2、项目的启动文件介绍

FluentWPF 项目的启动文件通常是 App.xamlApp.xaml.cs

App.xaml

<Application x:Class="FluentWPF.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

App.xaml.cs

using System.Windows;

namespace FluentWPF
{
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            ThemeManager.Current.Theme = Theme.Dark;
        }
    }
}

启动文件介绍

  • App.xaml: 定义了应用程序的启动界面和资源字典。

    • StartupUri="MainWindow.xaml": 指定应用程序启动时加载的主窗口。
    • ResourceDictionary.MergedDictionaries: 合并主题资源字典。
  • App.xaml.cs: 应用程序的代码隐藏文件。

    • OnStartup(StartupEventArgs e): 重写启动事件,设置应用程序的主题。

3、项目的配置文件介绍

FluentWPF 项目的配置文件主要是 FluentWPF.csprojFluentWPF.sln

FluentWP

FluentWPFFluent Design System for WPF.项目地址:https://gitcode.com/gh_mirrors/fl/FluentWPF

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梅昆焕Talia

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值