From faa8cf0ab957c9a5737eb539ec624ecdadc31e48 Mon Sep 17 00:00:00 2001 From: WPFTeamUser Date: Fri, 20 Oct 2023 08:28:27 +0000 Subject: [PATCH] New version of Telerik SDK examples. --- .../ChartUtilities.cs | 2 +- .../TrackBallLikeAnnotations/MainWindow.xaml | 6 + .../FitToWidthCommand.cs | 2 +- .../SinglePageLayoutManager.cs | 2 +- .../Commands/CustomOpenCommand.cs | 3 +- .../PaletteResourcesExtractor.csproj | 2 +- .../PaletteResourcesExtractor/Resources.xaml | 2 +- ToolBar/ToolBarCustomComboBoxStyle/App.config | 6 + ToolBar/ToolBarCustomComboBoxStyle/App.xaml | 17 ++ .../ToolBarCustomComboBoxStyle/App.xaml.cs | 11 + .../Converters/GlobalThemeToColorConverter.cs | 55 +++++ .../InvertedGlobalThemeToColorConverter.cs | 35 +++ .../CustomRadComboBoxStyle.csproj | 229 ++++++++++++++++++ .../CustomStyles/CrystalCustomStyles.xaml | 23 ++ .../CustomStyles/FluentCustomStyles.xaml | 24 ++ .../CustomStyles/GreenCustomStyles.xaml | 33 +++ .../CustomStyles/MaterialCustomStyles.xaml | 23 ++ .../CustomStyles/Office2013CustomStyles.xaml | 30 +++ .../CustomStyles/Office2016CustomStyles.xaml | 33 +++ .../Office2016TouchCustomStyles.xaml | 33 +++ .../CustomStyles/Office2019CustomStyles.xaml | 23 ++ .../Office_BlackCustomStyles.xaml | 32 +++ .../VisualStudio2013CustomStyles.xaml | 34 +++ .../VisualStudio2019CustomStyles.xaml | 34 +++ .../CustomStyles/Windows8CustomStyles.xaml | 30 +++ .../Windows8TouchCustomStyles.xaml | 23 ++ .../ExampleUserControl.xaml | 77 ++++++ .../ExampleUserControl.xaml.cs | 15 ++ .../ExampleViewModel.cs | 218 +++++++++++++++++ .../GlobalConstants.cs | 12 + .../MainWindow.xaml | 10 + .../MainWindow.xaml.cs | 15 ++ .../Properties/AssemblyInfo.cs | 55 +++++ .../Properties/Resources.Designer.cs | 71 ++++++ .../Properties/Resources.resx | 117 +++++++++ .../Properties/Settings.Designer.cs | 30 +++ .../Properties/Settings.settings | 7 + ToolBar/ToolBarCustomComboBoxStyle/Readme.md | 4 + ToolBar/ToolBar_WPF.sln | 11 +- 39 files changed, 1381 insertions(+), 8 deletions(-) create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/App.config create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/App.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/App.xaml.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Converters/GlobalThemeToColorConverter.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Converters/InvertedGlobalThemeToColorConverter.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomRadComboBoxStyle.csproj create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/CrystalCustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/FluentCustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/GreenCustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/MaterialCustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2013CustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016CustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016TouchCustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2019CustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office_BlackCustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2013CustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2019CustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8CustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8TouchCustomStyles.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/ExampleViewModel.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/GlobalConstants.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Properties/AssemblyInfo.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.Designer.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.resx create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.Designer.cs create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.settings create mode 100644 ToolBar/ToolBarCustomComboBoxStyle/Readme.md diff --git a/ChartView/WPF/TrackBallLikeAnnotations/ChartUtilities.cs b/ChartView/WPF/TrackBallLikeAnnotations/ChartUtilities.cs index 85812b216..3fa256421 100644 --- a/ChartView/WPF/TrackBallLikeAnnotations/ChartUtilities.cs +++ b/ChartView/WPF/TrackBallLikeAnnotations/ChartUtilities.cs @@ -112,7 +112,7 @@ private static void Chart_MouseMove(object sender, System.Windows.Input.MouseEve object currentXCategory = GetCurrentXCategory(chart); Point position = e.GetPosition(chart); - if (!chart.PlotAreaClip.Contains(position.X, position.Y)) + if (!chart.PlotAreaClip.Contains(position.X - chart.PanOffset.X, position.Y - chart.PanOffset.Y)) { if (HidesAnnotationsOnMouseLeave && currentXCategory != null) { diff --git a/ChartView/WPF/TrackBallLikeAnnotations/MainWindow.xaml b/ChartView/WPF/TrackBallLikeAnnotations/MainWindow.xaml index 95c5d0213..90dc9a170 100644 --- a/ChartView/WPF/TrackBallLikeAnnotations/MainWindow.xaml +++ b/ChartView/WPF/TrackBallLikeAnnotations/MainWindow.xaml @@ -48,6 +48,9 @@ + + + + + + { str.Close(); diff --git a/Theming/PaletteResourcesExtractor/PaletteResourcesExtractor.csproj b/Theming/PaletteResourcesExtractor/PaletteResourcesExtractor.csproj index c9bffd7fc..90942e1cc 100644 --- a/Theming/PaletteResourcesExtractor/PaletteResourcesExtractor.csproj +++ b/Theming/PaletteResourcesExtractor/PaletteResourcesExtractor.csproj @@ -50,7 +50,7 @@ False - ..\..\..\..\Binaries\WPF\Telerik.Windows.Controls.dll + $(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll diff --git a/Theming/PaletteResourcesExtractor/Resources.xaml b/Theming/PaletteResourcesExtractor/Resources.xaml index 120b91de7..61a0a27ec 100644 --- a/Theming/PaletteResourcesExtractor/Resources.xaml +++ b/Theming/PaletteResourcesExtractor/Resources.xaml @@ -1,4 +1,4 @@ - diff --git a/ToolBar/ToolBarCustomComboBoxStyle/App.config b/ToolBar/ToolBarCustomComboBoxStyle/App.config new file mode 100644 index 000000000..8e1564635 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/App.xaml b/ToolBar/ToolBarCustomComboBoxStyle/App.xaml new file mode 100644 index 000000000..e330d2576 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/App.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/ToolBar/ToolBarCustomComboBoxStyle/App.xaml.cs b/ToolBar/ToolBarCustomComboBoxStyle/App.xaml.cs new file mode 100644 index 000000000..76d3e09e6 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/App.xaml.cs @@ -0,0 +1,11 @@ +using System.Windows; + +namespace CustomRadComboBoxStyle +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Converters/GlobalThemeToColorConverter.cs b/ToolBar/ToolBarCustomComboBoxStyle/Converters/GlobalThemeToColorConverter.cs new file mode 100644 index 000000000..3409ec725 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Converters/GlobalThemeToColorConverter.cs @@ -0,0 +1,55 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Windows.Data; +using System.Windows.Media; + +namespace CustomRadComboBoxStyle.Converters +{ + public class GlobalThemeToColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var tokens = value.ToString().Split('_').ToArray(); + + if (tokens.Length <= 1) + { + return Brushes.White; + } + + var themeVariation = tokens[1]; + + if (themeVariation == "Dark") + { + return Brushes.Black; + } + else if (themeVariation == "Gray") + { + return Brushes.Gray; + } + else if (themeVariation == "LightGray") + { + return Brushes.LightGray; + } + else if (themeVariation == "DarkGray") + { + return Brushes.DarkGray; + } + else if (themeVariation == "Blue") + { + return Brushes.MediumPurple; + } + else if (themeVariation == "HighContrast") + { + return Brushes.Black; + } + + return Brushes.White; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Converters/InvertedGlobalThemeToColorConverter.cs b/ToolBar/ToolBarCustomComboBoxStyle/Converters/InvertedGlobalThemeToColorConverter.cs new file mode 100644 index 000000000..42140d6f1 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Converters/InvertedGlobalThemeToColorConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Windows.Data; +using System.Windows.Media; + +namespace CustomRadComboBoxStyle.Converters +{ + public class InvertedGlobalThemeToColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var tokens = value.ToString().Split('_').ToArray(); + + if (tokens.Length <= 1) + { + return Brushes.Black; + } + + var themeVariation = tokens[1]; + + if (themeVariation == "Dark" || themeVariation == "HighContrast") + { + return Brushes.White; + } + + return Brushes.Black; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomRadComboBoxStyle.csproj b/ToolBar/ToolBarCustomComboBoxStyle/CustomRadComboBoxStyle.csproj new file mode 100644 index 000000000..05d3acde2 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomRadComboBoxStyle.csproj @@ -0,0 +1,229 @@ + + + + + Debug + AnyCPU + {521F2335-D2AB-425C-B891-EE6BADA3CEAE} + WinExe + CustomRadComboBoxStyle + CustomRadComboBoxStyle + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + False + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.dll + + + False + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.Input.dll + + + False + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.Navigation.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Crystal.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Fluent.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Green.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Material.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office2013.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office2016.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office2016Touch.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office2019.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office_Black.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office_Blue.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office_Silver.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Summer.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Transparent.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Vista.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.VisualStudio2013.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.VisualStudio2019.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Windows7.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Windows8.dll + + + $(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Windows8Touch.dll + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + ExampleUserControl.xaml + + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/CrystalCustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/CrystalCustomStyles.xaml new file mode 100644 index 000000000..39f15216b --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/CrystalCustomStyles.xaml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/FluentCustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/FluentCustomStyles.xaml new file mode 100644 index 000000000..74bf7eadf --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/FluentCustomStyles.xaml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/GreenCustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/GreenCustomStyles.xaml new file mode 100644 index 000000000..7aca1247f --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/GreenCustomStyles.xaml @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/MaterialCustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/MaterialCustomStyles.xaml new file mode 100644 index 000000000..55b406d8e --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/MaterialCustomStyles.xaml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2013CustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2013CustomStyles.xaml new file mode 100644 index 000000000..57a91e6d2 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2013CustomStyles.xaml @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016CustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016CustomStyles.xaml new file mode 100644 index 000000000..a15673913 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016CustomStyles.xaml @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016TouchCustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016TouchCustomStyles.xaml new file mode 100644 index 000000000..f7be766be --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2016TouchCustomStyles.xaml @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2019CustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2019CustomStyles.xaml new file mode 100644 index 000000000..39f15216b --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office2019CustomStyles.xaml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office_BlackCustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office_BlackCustomStyles.xaml new file mode 100644 index 000000000..59b61fb25 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Office_BlackCustomStyles.xaml @@ -0,0 +1,32 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2013CustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2013CustomStyles.xaml new file mode 100644 index 000000000..9fb6c7d5d --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2013CustomStyles.xaml @@ -0,0 +1,34 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2019CustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2019CustomStyles.xaml new file mode 100644 index 000000000..d8b59fc3d --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/VisualStudio2019CustomStyles.xaml @@ -0,0 +1,34 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8CustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8CustomStyles.xaml new file mode 100644 index 000000000..1efa508a8 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8CustomStyles.xaml @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8TouchCustomStyles.xaml b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8TouchCustomStyles.xaml new file mode 100644 index 000000000..462dc5880 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/CustomStyles/Windows8TouchCustomStyles.xaml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml b/ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml new file mode 100644 index 000000000..27e49b7a9 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Item 1 + Item 2 + Item 3 + + + Item 1 + Item 2 + Item 3 + + + + + + + diff --git a/ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml.cs b/ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml.cs new file mode 100644 index 000000000..bcc71453e --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/ExampleUserControl.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace CustomRadComboBoxStyle +{ + /// + /// Interaction logic for ExampleUserControl.xaml + /// + public partial class ExampleUserControl : UserControl + { + public ExampleUserControl() + { + InitializeComponent(); + } + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/ExampleViewModel.cs b/ToolBar/ToolBarCustomComboBoxStyle/ExampleViewModel.cs new file mode 100644 index 000000000..7626fce5c --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/ExampleViewModel.cs @@ -0,0 +1,218 @@ +using System; +using System.Collections.Generic; +using System.Windows.Input; +using System.Windows; +using Telerik.Windows.Controls; + +namespace CustomRadComboBoxStyle +{ + public class ExampleViewModel : ViewModelBase + { + private string selectedTheme; + + public ExampleViewModel() + { + this.Themes = (List)this.AddThemes(); + this.SelectedTheme = this.Themes[0]; + this.ThemeChangedCommand = new DelegateCommand(OnThemeChanged); + } + + public string SelectedTheme + { + get { return selectedTheme; } + set { selectedTheme = value; OnPropertyChanged("SelectedTheme"); } + } + public List Themes { get; set; } + public ICommand ThemeChangedCommand { get; set; } + + private ICollection AddThemes() + { + var collection = new List + { + "Office_Black", + "Windows8", + "Windows8Touch", + "Office2013", + "Office2013_LightGray", + "Office2013_DarkGray", + "VisualStudio2013", + "VisualStudio2013_Blue", + "VisualStudio2013_Dark", + "Green_Light", + "Green_Dark", + "Office2016", + "Office2016Touch", + "Fluent", + "Fluent_Dark", + "Material", + "Material_Dark", + "Crystal", + "Crystal_Dark", + "VisualStudio2019", + "Office2019_Light", + "Office2019_Gray", + "Office2019_Dark", + "Office2019_HighContrast" + }; + + return collection; + } + + private void OnThemeChanged(object obj) + { + this.ChangeThemeNoXaml(this.SelectedTheme); + } + + private void ChangeThemeNoXaml(string themeName) + { + themeName = ChoseTheme(themeName); + + Application.Current.Resources.MergedDictionaries.Clear(); + + foreach (string file in GlobalConstants.assembliesXamlFiles) + { + string assembly = string.Format(@"/Telerik.Windows.Themes.{0};component/Themes" + file, themeName); + + Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() + { + Source = new Uri(assembly, UriKind.RelativeOrAbsolute) + }); + } + + Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() + { + Source = new Uri("CustomStyles/" + themeName + "CustomStyles.xaml", UriKind.RelativeOrAbsolute) + }); + } + + private string ChoseTheme(string themeName) + { + if (themeName.Contains("Office2013")) + { + switch (themeName) + { + case "Office2013_LightGray": + Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.LightGray); + break; + case "Office2013_DarkGray": + Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.DarkGray); + break; + default: + Office2013Palette.LoadPreset(Office2013Palette.ColorVariation.White); + break; + } + + themeName = "Office2013"; + } + else if (themeName.Contains("VisualStudio2013")) + { + switch (themeName) + { + case "VisualStudio2013_Dark": + VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Dark); + break; + case "VisualStudio2013_Blue": + VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Blue); + break; + default: + VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Light); + break; + } + themeName = "VisualStudio2013"; + } + else if (themeName.Contains("Green")) + { + switch (themeName) + { + case "Green_Dark": + GreenPalette.LoadPreset(GreenPalette.ColorVariation.Dark); + break; + default: + GreenPalette.LoadPreset(GreenPalette.ColorVariation.Light); + break; + } + + themeName = "Green"; + } + else if (themeName.Contains("Fluent")) + { + switch (themeName) + { + case "Fluent_Dark": + FluentPalette.LoadPreset(FluentPalette.ColorVariation.Dark); + break; + default: + FluentPalette.LoadPreset(FluentPalette.ColorVariation.Light); + break; + } + + themeName = "Fluent"; + } + else if (themeName.Contains("Crystal")) + { + switch (themeName) + { + case "Crystal_Dark": + CrystalPalette.LoadPreset(CrystalPalette.ColorVariation.Dark); + break; + default: + CrystalPalette.LoadPreset(CrystalPalette.ColorVariation.Light); + break; + } + + themeName = "Crystal"; + } + else if (themeName.Contains("Office2019")) + { + switch (themeName) + { + case "Office2019_Gray": + Office2019Palette.LoadPreset(Office2019Palette.ColorVariation.Gray); + break; + case "Office2019_Dark": + Office2019Palette.LoadPreset(Office2019Palette.ColorVariation.Dark); + break; + case "Office2019_HighContrast": + Office2019Palette.LoadPreset(Office2019Palette.ColorVariation.HighContrast); + break; + default: + Office2019Palette.LoadPreset(Office2019Palette.ColorVariation.Light); + break; + } + + themeName = "Office2019"; + } + else if (themeName.Contains("Material")) + { + switch (themeName) + { + case "Material_Dark": + MaterialPalette.LoadPreset(MaterialPalette.ColorVariation.Dark); + break; + + default: + MaterialPalette.LoadPreset(MaterialPalette.ColorVariation.Light); + break; + } + + themeName = "Material"; + } + else if (themeName.Contains("VisualStudio2019")) + { + switch (themeName) + { + case "VisualStudio2019_Dark": + VisualStudio2019Palette.LoadPreset(VisualStudio2019Palette.ColorVariation.Dark); + break; + default: + VisualStudio2019Palette.LoadPreset(VisualStudio2019Palette.ColorVariation.Blue); + break; + } + + themeName = "VisualStudio2019"; + } + + return themeName; + } + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/GlobalConstants.cs b/ToolBar/ToolBarCustomComboBoxStyle/GlobalConstants.cs new file mode 100644 index 000000000..8802931d6 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/GlobalConstants.cs @@ -0,0 +1,12 @@ +namespace CustomRadComboBoxStyle +{ + public static class GlobalConstants + { + internal static string[] assembliesXamlFiles = { + "/System.Windows.xaml", + "/Telerik.Windows.Controls.xaml", + "/Telerik.Windows.Controls.Input.xaml", + "/Telerik.Windows.Controls.Navigation.xaml", + }; + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml b/ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml new file mode 100644 index 000000000..3c807b5cb --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml @@ -0,0 +1,10 @@ + + + diff --git a/ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml.cs b/ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml.cs new file mode 100644 index 000000000..03e93a166 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/MainWindow.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows; + +namespace CustomRadComboBoxStyle +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Properties/AssemblyInfo.cs b/ToolBar/ToolBarCustomComboBoxStyle/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..57bb8c777 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CustomRadComboBoxStyle")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Progress")] +[assembly: AssemblyProduct("CustomRadComboBoxStyle")] +[assembly: AssemblyCopyright("Copyright © Progress 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.Designer.cs b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.Designer.cs new file mode 100644 index 000000000..3bd013cdb --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CustomRadComboBoxStyle.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CustomRadComboBoxStyle.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.resx b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.Designer.cs b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.Designer.cs new file mode 100644 index 000000000..e558f31b9 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CustomRadComboBoxStyle.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.settings b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ToolBar/ToolBarCustomComboBoxStyle/Readme.md b/ToolBar/ToolBarCustomComboBoxStyle/Readme.md new file mode 100644 index 000000000..f3570901c --- /dev/null +++ b/ToolBar/ToolBarCustomComboBoxStyle/Readme.md @@ -0,0 +1,4 @@ +## Tool Bar Custom ComboBox Style +The CustomRadComboBoxStyle project demonstrates the correct approach for setting a custom style for a RadComboBox control placed in RadToolbar. + +[//]: \ No newline at end of file diff --git a/ToolBar/ToolBar_WPF.sln b/ToolBar/ToolBar_WPF.sln index 754b1ecc9..1e6a03279 100644 --- a/ToolBar/ToolBar_WPF.sln +++ b/ToolBar/ToolBar_WPF.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolBarMVVM", "ToolBarMVVM\ToolBarMVVM.csproj", "{28C68DF6-F7E0-4116-9C33-B4C9B87D04AA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolBarCustomStyledElements_WPF", "ToolBarCustomStyledElements\ToolBarCustomStyledElements_WPF.csproj", "{E72916A9-9942-4CA5-8006-AD13DA110B9A}" @@ -9,8 +11,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolbarRightAlignedItems", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolBarDragAndDrop", "ToolBarDragAndDrop\ToolBarDragAndDrop.csproj", "{16AA763D-110F-47F9-BA85-73E04E69660F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomRadComboBoxStyle", "ToolBarCustomComboBoxStyle\CustomRadComboBoxStyle.csproj", "{521F2335-D2AB-425C-B891-EE6BADA3CEAE}" +EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -32,6 +35,10 @@ Global {16AA763D-110F-47F9-BA85-73E04E69660F}.Debug|Any CPU.Build.0 = Debug|Any CPU {16AA763D-110F-47F9-BA85-73E04E69660F}.Release|Any CPU.ActiveCfg = Release|Any CPU {16AA763D-110F-47F9-BA85-73E04E69660F}.Release|Any CPU.Build.0 = Release|Any CPU + {521F2335-D2AB-425C-B891-EE6BADA3CEAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {521F2335-D2AB-425C-B891-EE6BADA3CEAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {521F2335-D2AB-425C-B891-EE6BADA3CEAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {521F2335-D2AB-425C-B891-EE6BADA3CEAE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE