コード例 #1
0
        ResourceDictionary GetTheme(string color, string accent)
        {
            string themeName = string.Format("NoesisTheme.Brushes.{0}{1}.xaml", color, accent);

            ResourceDictionary theme;

            if (ThemeDictionaries.TryGetValue(themeName, out theme))
            {
                return(theme);
            }

            Uri uri = new Uri("pack://application:,,,/Noesis.GUI.Extensions;component/Theme/" + themeName, UriKind.RelativeOrAbsolute);

            theme = new ResourceDictionary {
                Source = uri
            };
            ThemeDictionaries.Add(themeName, theme);

            return(theme);
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: pdan1/Tutorials
        ResourceDictionary GetTheme(string color, string accent)
        {
            string themeName = string.Format("NoesisTheme.Brushes.{0}{1}.xaml", color, accent);

            ResourceDictionary theme;

            if (ThemeDictionaries.TryGetValue(themeName, out theme))
            {
                return(theme);
            }

            Uri uri = new Uri("Assets/NoesisGUI/Theme/" + themeName, UriKind.Relative);

            theme = new ResourceDictionary {
                Source = uri
            };
            ThemeDictionaries.Add(themeName, theme);

            return(theme);
        }