Avalonia中引入资源文件

CustomResources.axaml

<ResourceDictionary
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctl="clr-namespace:CommandTerminal.Controls">

    <!--  自定义的资源信息  -->

</ResourceDictionary>

CustomResources.axaml文件的【生成操作】需要修改成【AvaloniaResource】。

在App.axaml文件中引入

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceInclude Source="avares://CommandTerminal/Themes/CustomResources.axaml" />

                <ResourceDictionary>
                    <!--  其它资源信息  -->
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
posted @ 2024-05-30 14:08  wzwyc  阅读(40)  评论(0编辑  收藏  举报