この記事の Style Binding を WPF & Silverlightに実装しようとしています。
次のコードを含むリソース ディクショナリ、generic.Xaml があります。
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/AComponent;component/Themes/MyCustomStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
MyCustomStyles.xaml がこのように始まる場所
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<t:ThemeColorProvider x:Key="ThemeProvider"/>
Generic.xaml でバインドしている色/ブラシを更新するには、ThemeProvider のインスタンスを取得する必要があります。「ThemeProvider」キーを持つリソースのインスタンスを取得して更新することはできますか?
クロス プラットフォームの WPF と Silverlight の実装を知っている場合は、追加のクレジットが必要です!
注: Generic.xaml を宣言するアセンブリの外でこれを取得する必要があります。