windows phone 8 - ResourceDictionary with Caliburn Micro -
app.xaml <application.resources> <local:appbootstrapper xmlns:local="clr-namespace:kyms" x:key="bootstrapper" /> <local:localizedstrings xmlns:local="clr-namespace:kyms" x:key="localizedstrings"/> <resourcedictionary x:key="customdictionary"> <resourcedictionary.mergeddictionaries> <resourcedictionary source="styles/styles.xaml" /> </resourcedictionary.mergeddictionaries> </resourcedictionary> </application.resources>
my resource in styles/styles.xaml
<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <style x:key="mycolorbutton" targettype="button"> ....... </style>
in viewmodel (use caliburn micro mvvm pattern) if call code
app.current.resources.mergeddictionaries[0]
app.current.resources.mergeddictionaries.count = 0
but not works, why?
i'm resolved
in appbootstrapper.cs i'm insert
private void loaddictionary() { var dictionaries = app.current.resources.mergeddictionaries; dictionaries.clear(); var themestyles = new resourcedictionary { source = new uri("/myassemblyname;component/styles/styles.xaml", urikind.relativeorabsolute) }; dictionaries.add(themestyles); }
and works!
Comments
Post a Comment