3

私はBrushes.xamlにこれを持っています:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:SkinBox.Controls">
    <SolidColorBrush x:Key="{x:Static controls:Keys.BackgroundBrushKey}"
                     Color="{DynamicResource {x:Static controls:Keys.BackgroundColorKey}}" />
</ResourceDictionary>

そして、Generic.xaml で次のように使用します。

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:SkinBox.Controls"
                    xmlns:system="clr-namespace:System;assembly=System">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/SkinBox.Controls;component/Themes/Skins/Blue.xaml" />
        <ResourceDictionary Source="pack://application:,,,/SkinBox.Controls;component/Themes/Brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

問題は、wpf がブラシをフリーズするため、DynamicResource効果がないことです。

これを解決するきれいな方法はありますか?厄介なハックしか思い浮かびません。

4

1 に答える 1