2016-09-23 50 views
0

在我的應用程序中,我使用ResourceDictionaries作爲樣式。例如:來自HDD文件的WPF樣式

<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> 

可以說,作爲一個用戶,我知道資源字典是怎麼樣的。是否有可能從我自己的文件從硬盤覆蓋資源?我想添加允許用戶執行此操作的功能。

我的硬盤文件:

<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> 
+0

你是一個開發者「用戶」這就是使用你的控制?或者您想允許更改已編譯應用程序的外觀和感覺的最終用戶? – SledgeHammer

+0

我的意思是最終用戶。 – Piotrek

+0

你想讓一個隨機的最終用戶混淆你的XAML?讓人驚訝。礦場。爲什麼不只是一個更友好的設置對話框。 – SledgeHammer

回答