I'm working on an application where I want to let my user choose which theme/skin they want to use. I'm using the pack of themes available from Codeplex.
So I need the ability to dynamically load the theme. After research considerable number of sites, I found a number of samples that use code that looks like what I'm using -
Application.Current.Resources.MergedDictionaries.Clear();
var item = (ComboBoxItem) comboThemeSelect.SelectedItem;
var t = item.Content.ToString();
t = Properties.Settings.Default.ThemeDir.Replace("\r\n", "") + "\\" + t;
Uri themeUri = new Uri(t, UriKind.Relative);
ResourceDictionary theme = ResourceDictionary)Application.LoadComponent(themeUri);
Application.Current.Resources.MergedDictionaries.Add(theme);
string variable t contains the absolute path and file name of the theme in the Uri(t...) statement. When I run this, I'm getting a Stream error reading in the file.
Any suggestions on how to do this function. I would think that this should be fairly easy to do, but I don't seem to be able to figure it out.