Beispiel #1
0
        private void MenuItem_Click(object sender, RadioMenuEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(e.CurrentKey) == false)
            {
                ThemeDictionaryExtension tde = new ThemeDictionaryExtension(e.CurrentKey);
                ResourceDictionary       d   = Application.Current.Resources.MergedDictionaries[1];
                var uri = tde.ProvideValue(new sp(d)) as Uri;
                if (d.Source.ToString() != uri.ToString())
                {
                    d.Source = uri;
                    //Application.Current.Resources.Remove(2);
                    //Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = uri });
                    if (regionManager != null && regionManager.Regions[RegionNames.MenuRegion] != null)
                    {
                        foreach (var view in regionManager.Regions[RegionNames.MenuRegion].Views.Cast <SplitButton>())
                        {
                            var style = view.TryFindResource(typeof(SplitButton)) as Style;
                            view.SetValue(FrameworkElement.StyleProperty, style);
                        }
                    }
                }
            }

            //d.Source = new Uri("pack://application:,,,/RF.WinApp.Themes.T1;component/Themes/generic.xaml");
        }
Beispiel #2
0
        private void MenuItem_Click(object sender, RadioMenuEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(e.CurrentKey) == false)
            {
                ThemeDictionaryExtension tde = new ThemeDictionaryExtension(e.CurrentKey);
                ResourceDictionary d = Application.Current.Resources.MergedDictionaries[1];
                var uri = tde.ProvideValue(new sp(d)) as Uri;
                if (d.Source.ToString() != uri.ToString())
                {
                    d.Source = uri;
                    //Application.Current.Resources.Remove(2);
                    //Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = uri });
                    if (regionManager != null && regionManager.Regions[RegionNames.MenuRegion] != null)
                        foreach (var view in regionManager.Regions[RegionNames.MenuRegion].Views.Cast<SplitButton>())
                        {
                            var style = view.TryFindResource(typeof(SplitButton)) as Style;
                            view.SetValue(FrameworkElement.StyleProperty, style);
                        }
                }
            }

            //d.Source = new Uri("pack://application:,,,/RF.WinApp.Themes.T1;component/Themes/generic.xaml");
        }