我有下面的代碼是非常簡單的在WP7風格的資源,改變風格引領者屬性
<Style x:Name="image_find" x:Key="ImageFind1" TargetType="Image">
<Setter Property="Source" Value="display/pen.png"/>
</Style>
我想改變二傳手的源值,爲前。 「顯示/ tool.png」當我想在我的應用程序的代碼的運行時旁邊,採取記住,我需要的圖像風格:)
我正在這樣的事情,
image_find.Setters.SetValue(Image.SourceProperty, "display/tool.png");
什麼beeing像,
style = App.Current.Resources["image_find1"] as Style;
style.Setters.SetValue(Image.SourceProperty, "display/tool.png");`
和我得到NullReferenceException
和應用程式的空檔......
此款式在哪裏? – 2013-03-01 10:48:00