WinUIEx 开源项目教程

WinUIEx 开源项目教程

WinUIExWinUI Extensions项目地址:https://gitcode.com/gh_mirrors/wi/WinUIEx

项目的目录结构及介绍

WinUIEx 项目的目录结构如下:

WinUIEx/
├── src/
│   ├── WinUIEx/
│   │   ├── Properties/
│   │   ├── Assets/
│   │   ├── obj/
│   │   ├── bin/
│   │   ├── WinUIEx.csproj
│   │   ├── MainWindow.xaml
│   │   ├── MainWindow.xaml.cs
│   │   ├── App.xaml
│   │   ├── App.xaml.cs
│   │   └── ...
│   └── WinUIEx.Tests/
│       ├── Properties/
│       ├── obj/
│       ├── bin/
│       ├── WinUIEx.Tests.csproj
│       └── ...
├── .gitignore
├── LICENSE
├── README.md
└── ...

目录结构介绍

  • src/WinUIEx/: 主项目目录,包含所有源代码文件。

    • Properties/: 包含项目属性文件。
    • Assets/: 包含项目所需的资源文件,如图片等。
    • obj/bin/: 编译过程中生成的中间文件和最终输出文件。
    • WinUIEx.csproj: 项目文件,定义项目配置和依赖项。
    • MainWindow.xamlMainWindow.xaml.cs: 主窗口的 XAML 和代码文件。
    • App.xamlApp.xaml.cs: 应用程序的 XAML 和代码文件。
  • src/WinUIEx.Tests/: 测试项目目录,包含所有测试代码文件。

    • Properties/: 包含测试项目属性文件。
    • obj/bin/: 编译过程中生成的中间文件和最终输出文件。
    • WinUIEx.Tests.csproj: 测试项目文件,定义测试项目配置和依赖项。
  • .gitignore: Git 忽略文件,定义哪些文件和目录不需要被版本控制。

  • LICENSE: 项目许可证文件。

  • README.md: 项目说明文件,包含项目介绍、使用说明等。

项目的启动文件介绍

WinUIEx 项目的启动文件是 App.xamlApp.xaml.cs

App.xaml

App.xaml 文件定义了应用程序的资源和启动配置:

<Application
    x:Class="WinUIEx.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinUIEx">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                <!-- Other merged dictionaries here -->
            </ResourceDictionary.MergedDictionaries>
            <!-- Other resources here -->
        </ResourceDictionary>
    </Application.Resources>
</Application>

App.xaml.cs

App.xaml.cs 文件包含了应用程序的代码逻辑:

namespace WinUIEx
{
    public partial class App : Application
    {
        public App()
        {
            this.InitializeComponent();
        }

        protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
        {
            m_window = new MainWindow();
            m_window.Activate();
        }

        private Window m_window;
    }
}

项目的配置文件介绍

WinUIEx 项目的配置文件主要是 WinUIEx.csproj

WinUIEx.csproj

WinUIEx.csproj 文件定义了项目的配置和依赖项:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
    <UseWPF>true</UseWPF>
    <UseWinUI>true</UseWin

WinUIExWinUI Extensions项目地址:https://gitcode.com/gh_mirrors/wi/WinUIEx

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

邴坤鸿Jewel

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

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

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

打赏作者

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

抵扣说明:

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

余额充值