簡體   English   中英

HDD文件中的WPF樣式

[英]WPF style from HDD file

在我的應用程序中,我使用ResourceDictionaries作為樣式。 例:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type Button}" x:Key="SimpleButton">
        <Setter Property="Foreground" Value="{DynamicResource SpecialRed}"/>
        <Setter Property="FontSize" Value="40"/>
        <Setter Property="Margin" Value="10"/>
    </Style>

</ResourceDictionary>

可以說,作為用戶,我知道資源字典的外觀。 是否可以從HDD覆蓋我自己的文件中的資源? 我想添加允許用戶執行此操作的功能。

我的硬盤文件:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type Button}" x:Key="SimpleButton">
        <Setter Property="Foreground" Value="{DynamicResource SpecialRed}"/>
        <Setter Property="FontSize" Value="70"/>
        <Setter Property="Margin" Value="20"/>
    </Style>

</ResourceDictionary>

如果您堅持要這樣做(我不會),則可以在運行時合並資源字典: 將資源字典文件動態加載到wpf應用程序會出現錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM