├── .gitattributes ├── .gitignore ├── LICENSE ├── MaterialDesignExtensions.sln ├── MaterialDesignExtensions ├── Commands │ └── Internal │ │ ├── AutocompleteCommands.cs │ │ ├── FileSystemControlCommands.cs │ │ ├── OversizedNumberSpinnerCommands.cs │ │ ├── SearchControlCommands.cs │ │ ├── SideNavigationCommands.cs │ │ ├── StepperCommands.cs │ │ └── TextBoxSuggestionsCommands.cs ├── Controllers │ ├── AutocompleteController.cs │ ├── BitmapImageHelper.cs │ ├── FileControlHelper.cs │ ├── FileFilterHelper.cs │ ├── FileNameHelper.cs │ ├── FileSystemController.cs │ ├── SearchSuggestionsController.cs │ └── StepperController.cs ├── Controls │ ├── AlertDialog.cs │ ├── AppBar.cs │ ├── Autocomplete.cs │ ├── AutocompletePopup.cs │ ├── BaseFileControl.cs │ ├── BaseFileDialog.cs │ ├── BusyOverlay.cs │ ├── ConfirmationDialog.cs │ ├── ControlWithAutocompletePopup.cs │ ├── FileSystemControl.cs │ ├── FileSystemDialog.cs │ ├── IStepper.cs │ ├── InputDialog.cs │ ├── MaterialNavigationWindow.cs │ ├── MaterialWindow.cs │ ├── MessageDialog.cs │ ├── NavigationRail.cs │ ├── OpenDirectoryControl.cs │ ├── OpenDirectoryDialog.cs │ ├── OpenFileControl.cs │ ├── OpenFileDialog.cs │ ├── OpenMultipleDirectoriesControl.cs │ ├── OpenMultipleDirectoriesDialog.cs │ ├── OpenMultipleFilesControl.cs │ ├── OpenMultipleFilesDialog.cs │ ├── OversizedNumberSpinner.cs │ ├── PersistentSearch.cs │ ├── SaveFileControl.cs │ ├── SaveFileDialog.cs │ ├── SearchBase.cs │ ├── SideNavigation.cs │ ├── StepButtonBar.cs │ ├── StepTitleHeaderControl.cs │ ├── Stepper.cs │ ├── TabControlAssist.cs │ ├── TabControlStepper.cs │ ├── TextBoxFileSystemPath.cs │ ├── TextBoxOpenDirectory.cs │ ├── TextBoxOpenFile.cs │ ├── TextBoxSaveFile.cs │ ├── TextBoxSuggestions.cs │ └── TransitionContentControl.cs ├── Converters │ ├── AsyncImageTask.cs │ ├── BoolToVisibilityConverter.cs │ ├── BooleanAndConverter.cs │ ├── BooleanAndToVisibilityConverter.cs │ ├── BooleanOrConverter.cs │ ├── BooleanOrToVisibilityConverter.cs │ ├── DateTimeAgoConverter.cs │ ├── EmptyEnumerableToBoolConverter.cs │ ├── EmptyEnumerableVisibilityConverter.cs │ ├── FileFiltersTypeConverter.cs │ ├── FileSizeConverter.cs │ ├── FileSystemInfoIconConverter.cs │ ├── FileSystemInfoPackIconColorConverter.cs │ ├── NotNullBooleanConverter.cs │ ├── NotNullToVisibilityConverter.cs │ ├── NullToVisibilityConverter.cs │ ├── ObjectCollectionToVisibilityConverter.cs │ ├── ObjectHasTypeConverter.cs │ ├── ObjectToTypeStringConverter.cs │ ├── StepIconTemplateConverter.cs │ ├── UpperCaseConverter.cs │ ├── WindowCaptionButtonBaseConverter.cs │ ├── WindowCaptionButtonEnabledConverter.cs │ ├── WindowCaptionButtonVisibilityConverter.cs │ ├── WindowTitleBarIconVisibilityConverter.cs │ └── WindowTitleVisibilityConverter.cs ├── Localization │ ├── Strings.Designer.cs │ ├── Strings.ar-DZ.Designer.cs │ ├── Strings.ar-DZ.resx │ ├── Strings.cs-cz.Designer.cs │ ├── Strings.cs-cz.resx │ ├── Strings.de.Designer.cs │ ├── Strings.de.resx │ ├── Strings.fr-FR.Designer.cs │ ├── Strings.fr-FR.resx │ ├── Strings.ja-JP.Designer.cs │ ├── Strings.ja-JP.resx │ ├── Strings.pt-BR.Designer.cs │ ├── Strings.pt-BR.resx │ ├── Strings.resx │ ├── Strings.ru-ru.Designer.cs │ ├── Strings.ru-ru.resx │ ├── Strings.uz-Latn-UZ.Designer.cs │ ├── Strings.uz-Latn-UZ.resx │ ├── Strings.zh-CN.Designer.cs │ └── Strings.zh-CN.resx ├── MaterialDesignExtensions.LongPath.nuspec ├── MaterialDesignExtensions.csproj ├── MaterialDesignExtensions.nuspec ├── Model │ ├── BaseNavigationItem.cs │ ├── DirectoryInfoItem.cs │ ├── DividerNavigationItem.cs │ ├── FileFilter.cs │ ├── FileInfoItem.cs │ ├── FileSystemEntriesGroupHeader.cs │ ├── FileSystemEntryItem.cs │ ├── FirstLevelNavigationItem.cs │ ├── IAutocompleteSource.cs │ ├── IAutocompleteSourceChangingItems.cs │ ├── INavigationItem.cs │ ├── ITextBoxSuggestionsSource.cs │ ├── NavigationItem.cs │ ├── NotSelectableNavigationItem.cs │ ├── SearchSuggestionItem.cs │ ├── SearchSuggestionsSource.cs │ ├── SecondLevelNavigationItem.cs │ ├── SpecialDirectory.cs │ ├── SpecialDrive.cs │ ├── Step.cs │ ├── StepTitleHeader.cs │ ├── StepperStepViewModel.cs │ └── SubheaderNavigationItem.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── TemplateSelectors │ ├── FileSystemEntryInfoTemplateSelector.cs │ ├── FileSystemEntryItemIconTemplateSelector.cs │ ├── FileSystemEntryItemTemplateSelector.cs │ ├── FileSystemInfoIconTemplateSelector.cs │ ├── HorizontalStepperHeaderTemplateSelector.cs │ ├── NavigationItemKindTemplateSelector.cs │ └── StepIconTemplateSelector.cs ├── Themes │ ├── AppBarTemplates.xaml │ ├── AutocompleteTemplates.xaml │ ├── BusyOverlayTemplates.xaml │ ├── ExtendedTheme.cs │ ├── ExtendedThemeExtensions.cs │ ├── FileSystemControlTemplates.xaml │ ├── FileSystemDialogTemplates.xaml │ ├── Generic.xaml │ ├── GridListTemplates.xaml │ ├── IExtendedBaseTheme.cs │ ├── IExtendedTheme.cs │ ├── MaterialDesignDarkTheme.xaml │ ├── MaterialDesignExtendedDarkTheme.cs │ ├── MaterialDesignExtendedLightTheme.cs │ ├── MaterialDesignLightTheme.xaml │ ├── MaterialWindowTemplates.xaml │ ├── MessageDialogTemplates.xaml │ ├── OversizedNumberSpinnerTemplate.xaml │ ├── PaletteHelper.cs │ ├── ResourceDictionaryExtensions.cs │ ├── SearchTemplates.xaml │ ├── SideNavigationTemplates.xaml │ ├── StepperTemplates.xaml │ ├── TabControlTemplates.xaml │ ├── TextBoxFileSystemPathTemplates.xaml │ ├── TextBoxSuggestionsTemplates.xaml │ └── TransitionContentControlTemplates.xaml └── key.snk ├── MaterialDesignExtensionsBuildUtility ├── App.config ├── BuildConfiguration.cs ├── BuildException.cs ├── Configuration.cs ├── ConfigurationBuilder.cs ├── MaterialDesignExtensionsBuildUtility.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── Readme.md ├── MaterialDesignExtensionsDemo ├── App.config ├── App.xaml ├── App.xaml.cs ├── Controls │ ├── AppBarControl.xaml │ ├── AppBarControl.xaml.cs │ ├── AutocompleteControl.xaml │ ├── AutocompleteControl.xaml.cs │ ├── AutocompleteInTabControlControl.xaml │ ├── AutocompleteInTabControlControl.xaml.cs │ ├── BusyOverlayControl.xaml │ ├── BusyOverlayControl.xaml.cs │ ├── FileSystemDialogControl.xaml │ ├── FileSystemDialogControl.xaml.cs │ ├── GridListControl.xaml │ ├── GridListControl.xaml.cs │ ├── LanguageControl.xaml │ ├── LanguageControl.xaml.cs │ ├── MessageDialogControl.xaml │ ├── MessageDialogControl.xaml.cs │ ├── NavigationControl.xaml │ ├── NavigationControl.xaml.cs │ ├── NavigationRailControl.xaml │ ├── NavigationRailControl.xaml.cs │ ├── OpenDirectoryControlControl.xaml │ ├── OpenDirectoryControlControl.xaml.cs │ ├── OpenFileControlControl.xaml │ ├── OpenFileControlControl.xaml.cs │ ├── OpenMultipleDirectoriesControlControl.xaml │ ├── OpenMultipleDirectoriesControlControl.xaml.cs │ ├── OpenMultipleFilesControlControl.xaml │ ├── OpenMultipleFilesControlControl.xaml.cs │ ├── OversizedNumberSpinnerControl.xaml │ ├── OversizedNumberSpinnerControl.xaml.cs │ ├── SaveFileControlControl.xaml │ ├── SaveFileControlControl.xaml.cs │ ├── SearchControl.xaml │ ├── SearchControl.xaml.cs │ ├── StepperControl.xaml │ ├── StepperControl.xaml.cs │ ├── TabControlControl.xaml │ ├── TabControlControl.xaml.cs │ ├── TabControlStepperControl.xaml │ ├── TabControlStepperControl.xaml.cs │ ├── TextBoxFileSystemPathsControl.xaml │ ├── TextBoxFileSystemPathsControl.xaml.cs │ ├── TextBoxSuggestionsControl.xaml │ ├── TextBoxSuggestionsControl.xaml.cs │ ├── ThemesControl.xaml │ ├── ThemesControl.xaml.cs │ ├── WindowStyleControl.xaml │ └── WindowStyleControl.xaml.cs ├── DelegateCommand.cs ├── DemoNavigationWindow.xaml ├── DemoNavigationWindow.xaml.cs ├── DemoWindow.xaml ├── DemoWindow.xaml.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── MaterialDesignExtensionsDemo.csproj ├── NavigationItem.cs ├── Pages │ ├── Page1.xaml │ ├── Page1.xaml.cs │ ├── Page2.xaml │ └── Page2.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ViewModel │ ├── AlertDialogViewModel.cs │ ├── AppBarViewModel.cs │ ├── AutocompleteInTabControlViewModel.cs │ ├── AutocompleteViewModel.cs │ ├── BusyOverlayViewModel.cs │ ├── FileSystemControlViewModel.cs │ ├── FileSystemDialogViewModel.cs │ ├── GridListViewModel.cs │ ├── LanguageViewModel.cs │ ├── MessageDialogViewModel.cs │ ├── NavigationRailViewModel.cs │ ├── NavigationViewModel.cs │ ├── OpenDirectoryControlViewModel.cs │ ├── OpenFileControlViewModel.cs │ ├── OpenMultipleDirectoriesControlViewModel.cs │ ├── OpenMultipleFilesControlViewModel.cs │ ├── OversizedNumberSpinnerViewModel.cs │ ├── SaveFileControlViewModel.cs │ ├── SearchViewModel.cs │ ├── StepperBaseViewModel.cs │ ├── StepperViewModel.cs │ ├── TabControlStepperViewModel.cs │ ├── TabControlViewModel.cs │ ├── TextBoxFileSystemPathsViewModel.cs │ ├── TextBoxSuggestionsViewModel.cs │ ├── ThemesViewModel.cs │ ├── ViewModel.cs │ └── WindowStyleViewModel.cs ├── icon_on_background.ico └── icon_white.ico ├── MaterialDesignExtensionsTests ├── Controllers │ ├── FileFilterTest.cs │ ├── FileNameTest.cs │ └── FileSystemControllerTest.cs ├── Converters │ ├── DateTimeAgoConverterTest.cs │ └── FileFiltersTypeConverterTest.cs ├── MaterialDesignExtensionsTests.csproj └── Properties │ └── AssemblyInfo.cs ├── README.md ├── ReleaseNotes.md ├── additionalPackageFiles ├── License.txt ├── Notice.txt └── PackageReadme.md ├── buildNugetReleasePackage.bat ├── docs ├── css │ ├── prism.css │ ├── style.css │ └── theme.css ├── images │ └── GitHub-Mark-Light-120px-plus.png ├── index.html ├── js │ ├── AppViewModel.js │ ├── DocumentationItem.js │ ├── NavigationItem.js │ └── prism.js └── snippets │ ├── documentation.html │ ├── documentation │ ├── appbar.html │ ├── autocomplete.html │ ├── busyoverlay.html │ ├── filesystemcontrols.html │ ├── gridlist.html │ ├── materialwindow.html │ ├── navigation.html │ ├── oversizednumberspinner.html │ ├── search.html │ ├── stepper.html │ ├── tabs.html │ └── textboxsuggestions.html │ ├── home.html │ ├── license.html │ └── releasenotes.html ├── icon ├── icon.png ├── icon.svg └── icon_on_background.png └── screenshots ├── AlertDialog1.png ├── AppBar.png ├── AppBar1.png ├── Autocomplete.png ├── BusyOverlay.png ├── ConfirmationDialog1.png ├── FileDetail1.png ├── GridList.png ├── HorizontalStepper.png ├── MaterialWindow.png ├── MaterialWindow1.png ├── NavigationRail1.png ├── NavigationRail2.png ├── OpenDirectoryControl1.png ├── OpenFileControl1.png ├── OversizedNumberSpinner.png ├── PersistentSearch.png ├── SaveFileControl1.png ├── SideNavigation.png ├── TabControl1.png ├── TextBoxOpenDirectory1.png ├── TextBoxSuggestions.png └── VerticalStepper.png /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2020 Philipp Spiegel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Commands/Internal/AutocompleteCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | 8 | namespace MaterialDesignExtensions.Commands.Internal 9 | { 10 | /// 11 | /// Class containing commands used by the for internal use only. 12 | /// 13 | public class AutocompleteCommands 14 | { 15 | // abstract class with private constructor to prevent object initialization 16 | private AutocompleteCommands() { } 17 | 18 | /// 19 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 20 | /// 21 | public static readonly RoutedCommand SelectAutocompleteItemCommand = new RoutedCommand(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Commands/Internal/OversizedNumberSpinnerCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | 8 | namespace MaterialDesignExtensions.Commands.Internal 9 | { 10 | /// 11 | /// Class containing commands used by the for internal use only. 12 | /// 13 | public class OversizedNumberSpinnerCommands 14 | { 15 | // abstract class with private constructor to prevent object initialization 16 | private OversizedNumberSpinnerCommands() { } 17 | 18 | /// 19 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 20 | /// 21 | public static readonly RoutedCommand EditValueCommand = new RoutedCommand(); 22 | 23 | /// 24 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 25 | /// 26 | public static readonly RoutedCommand MinusCommand = new RoutedCommand(); 27 | 28 | /// 29 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 30 | /// 31 | public static readonly RoutedCommand PlusCommand = new RoutedCommand(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Commands/Internal/SearchControlCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | 8 | namespace MaterialDesignExtensions.Commands.Internal 9 | { 10 | /// 11 | /// Class containing commands used by the search controls for internal use only. 12 | /// 13 | public class SearchControlCommands 14 | { 15 | 16 | // abstract class with private constructor to prevent object initialization 17 | private SearchControlCommands() { } 18 | 19 | /// 20 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 21 | /// 22 | public static readonly RoutedCommand SelectSearchSuggestionCommand = new RoutedCommand(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Commands/Internal/SideNavigationCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | 8 | namespace MaterialDesignExtensions.Commands.Internal 9 | { 10 | /// 11 | /// Class containing commands used by the for internal use only. 12 | /// 13 | public class SideNavigationCommands 14 | { 15 | // abstract class with private constructor to prevent object initialization 16 | private SideNavigationCommands() { } 17 | 18 | /// 19 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 20 | /// 21 | public static readonly RoutedCommand SelectNavigationItemCommand = new RoutedCommand(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Commands/Internal/StepperCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | 8 | namespace MaterialDesignExtensions.Commands.Internal 9 | { 10 | /// 11 | /// Class containing commands used by the for internal use only. 12 | /// 13 | public class StepperCommands 14 | { 15 | // abstract class with private constructor to prevent object initialization 16 | private StepperCommands() { } 17 | 18 | /// 19 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 20 | /// 21 | public static readonly RoutedCommand BackCommand = new RoutedCommand(); 22 | 23 | /// 24 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 25 | /// 26 | public static readonly RoutedCommand CancelCommand = new RoutedCommand(); 27 | 28 | /// 29 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 30 | /// 31 | public static readonly RoutedCommand ContinueCommand = new RoutedCommand(); 32 | 33 | /// 34 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 35 | /// 36 | public static readonly RoutedCommand StepSelectedCommand = new RoutedCommand(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Commands/Internal/TextBoxSuggestionsCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | 8 | namespace MaterialDesignExtensions.Commands.Internal 9 | { 10 | /// 11 | /// Class containing commands used by the for internal use only. 12 | /// 13 | public class TextBoxSuggestionsCommands 14 | { 15 | // abstract class with private constructor to prevent object initialization 16 | private TextBoxSuggestionsCommands() { } 17 | 18 | /// 19 | /// Internal command used by the XAML template (public to be available in the XAML template). Not intended for external usage. 20 | /// 21 | public static readonly RoutedCommand SelectSuggestionItemCommand = new RoutedCommand(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Controllers/FileNameHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensions.Controllers 8 | { 9 | /// 10 | /// Helper class for operations on file names. 11 | /// 12 | public abstract class FileNameHelper 13 | { 14 | private static readonly ISet NotAllowedChars = new HashSet() { '<', '>', ':', '"', '/', '\\', '|', '?', '*' }; 15 | 16 | // abstract class with private constructor to prevent object initialization 17 | private FileNameHelper() { } 18 | 19 | /// 20 | /// Checks the specified file name if it is OK for the operation system. 21 | /// 22 | /// The file name to check 23 | /// boolean indication if teh file name is OK or not 24 | public static bool CheckFileName(string fileName) 25 | { 26 | // see https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#file-and-directory-names for file name constraints 27 | 28 | if (string.IsNullOrWhiteSpace(fileName)) 29 | { 30 | return false; 31 | } 32 | 33 | for (int i = 0; i < fileName.Length; i++) 34 | { 35 | char c = fileName[i]; 36 | ISet NotAllowedChars = new HashSet() { '<', '>', ':', '"', '/', '\\', '|', '?', '*' }; 37 | 38 | if (NotAllowedChars.Contains(c) || ((int)c) <= 31) 39 | { 40 | return false; 41 | } 42 | } 43 | 44 | return true; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Controls/BusyOverlay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace MaterialDesignExtensions.Controls 10 | { 11 | /// 12 | /// A control for displaying some kind of progress indication over the complete user interface while a long running operation is in progress. 13 | /// 14 | public class BusyOverlay : ContentControl 15 | { 16 | /// 17 | /// True, to switch the control into busy state and make it visible in the UI's foreground. 18 | /// 19 | public static readonly DependencyProperty IsBusyProperty = DependencyProperty.Register( 20 | nameof(IsBusy), typeof(bool), typeof(BusyOverlay), new PropertyMetadata(false)); 21 | 22 | /// 23 | /// True, to switch the control into busy state and make it visible in the UI's foreground. 24 | /// 25 | public bool IsBusy 26 | { 27 | get 28 | { 29 | return (bool)GetValue(IsBusyProperty); 30 | } 31 | 32 | set 33 | { 34 | SetValue(IsBusyProperty, value); 35 | } 36 | } 37 | 38 | /// 39 | /// The progress in percentage of the operation causing the busy state. 40 | /// 41 | public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register( 42 | nameof(Progress), typeof(int), typeof(BusyOverlay), new PropertyMetadata(0)); 43 | 44 | /// 45 | /// The progress in percentage of the operation causing the busy state. 46 | /// 47 | public int Progress 48 | { 49 | get 50 | { 51 | return (int)GetValue(ProgressProperty); 52 | } 53 | 54 | set 55 | { 56 | SetValue(ProgressProperty, value); 57 | } 58 | } 59 | 60 | /// 61 | /// Creates a new . 62 | /// 63 | public BusyOverlay() : base() { } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Controls/NavigationRail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using MaterialDesignExtensions.Model; 9 | 10 | namespace MaterialDesignExtensions.Controls 11 | { 12 | /// 13 | /// A special version of the side navigation. 14 | /// 15 | public class NavigationRail : SideNavigation 16 | { 17 | /// 18 | /// Creates a new . 19 | /// 20 | public NavigationRail() : base() { } 21 | 22 | protected override void InitItems(IList values) 23 | { 24 | if (m_navigationItemsControl != null) 25 | { 26 | IList navigationItems = new List(); 27 | 28 | if (values != null) 29 | { 30 | foreach (object item in values) 31 | { 32 | if (item is FirstLevelNavigationItem navigationItem) 33 | { 34 | navigationItems.Add(navigationItem); 35 | } 36 | else 37 | { 38 | throw new NotSupportedException($"Not supported item type {item.GetType().FullName}"); 39 | } 40 | } 41 | } 42 | 43 | m_navigationItemsControl.ItemsSource = navigationItems; 44 | 45 | INavigationItem selectedItem = navigationItems.FirstOrDefault(item => item.IsSelected); 46 | 47 | if (selectedItem != null) 48 | { 49 | if (SelectedItem != selectedItem) 50 | { 51 | SelectedItem = selectedItem; 52 | } 53 | } 54 | else 55 | { 56 | SelectedItem = null; 57 | } 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Controls/OpenFileControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | using System.Windows.Input; 12 | 13 | // use Pri.LongPath classes instead of System.IO for the MaterialDesignExtensions.LongPath build to support long file system paths on older Windows and .NET versions 14 | #if LONG_PATH 15 | using DirectoryInfo = Pri.LongPath.DirectoryInfo; 16 | using FileInfo = Pri.LongPath.FileInfo; 17 | using FileSystemInfo = Pri.LongPath.FileSystemInfo; 18 | #endif 19 | 20 | namespace MaterialDesignExtensions.Controls 21 | { 22 | /// 23 | /// A control for selecting a file to open. 24 | /// 25 | public class OpenFileControl : BaseFileControl 26 | { 27 | static OpenFileControl() 28 | { 29 | DefaultStyleKeyProperty.OverrideMetadata(typeof(OpenFileControl), new FrameworkPropertyMetadata(typeof(OpenFileControl))); 30 | } 31 | 32 | /// 33 | /// Creates a new . 34 | /// 35 | public OpenFileControl() : base() { } 36 | 37 | protected override void CurrentFileChangedHandler(string newCurrentFile) 38 | { 39 | try 40 | { 41 | m_controller.SelectFile(newCurrentFile); 42 | } 43 | catch (PathTooLongException) 44 | { 45 | SnackbarMessageQueue.Enqueue(Localization.Strings.LongPathsAreNotSupported); 46 | } 47 | } 48 | 49 | protected override void SelectFileSystemEntry(FileSystemInfo fileSystemInfo) 50 | { 51 | if (fileSystemInfo != null) 52 | { 53 | if (fileSystemInfo is DirectoryInfo directoryInfo) 54 | { 55 | CurrentDirectory = directoryInfo.FullName; 56 | CurrentFile = null; 57 | } 58 | else if (fileSystemInfo is FileInfo fileInfo) 59 | { 60 | CurrentFile = fileInfo.FullName; 61 | } 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Controls/PersistentSearch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace MaterialDesignExtensions.Controls 10 | { 11 | /// 12 | /// A control which implements the persistent search of the Material design specification (https://material.io/guidelines/patterns/search.html#search-in-app-search). 13 | /// 14 | public class PersistentSearch : SearchBase 15 | { 16 | /// 17 | /// The size of the displayed icons. 18 | /// 19 | public static readonly DependencyProperty IconSizeProperty = DependencyProperty.Register( 20 | nameof(IconSize), typeof(int), typeof(PersistentSearch), new PropertyMetadata(24)); 21 | 22 | /// 23 | /// The size of the displayed icons. 24 | /// 25 | public string IconSize 26 | { 27 | get 28 | { 29 | return (string)GetValue(IconSizeProperty); 30 | } 31 | 32 | set 33 | { 34 | SetValue(IconSizeProperty, value); 35 | } 36 | } 37 | 38 | static PersistentSearch() 39 | { 40 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PersistentSearch), new FrameworkPropertyMetadata(typeof(PersistentSearch))); 41 | } 42 | 43 | /// 44 | /// Creates a new . 45 | /// 46 | public PersistentSearch() : base() { } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Controls/StepTitleHeaderControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace MaterialDesignExtensions.Controls 10 | { 11 | /// 12 | /// Control for a header of a stepper step to enable data bindings. 13 | /// 14 | public class StepTitleHeaderControl : Control 15 | { 16 | /// 17 | /// The text of the first level title. 18 | /// A value of null will hide this title. 19 | /// 20 | public static readonly DependencyProperty FirstLevelTitleProperty = DependencyProperty.Register( 21 | nameof(FirstLevelTitle), typeof(string), typeof(StepTitleHeaderControl), new PropertyMetadata(null, null)); 22 | 23 | /// 24 | /// The text of the first level title. 25 | /// A value of null will hide this title. 26 | /// 27 | public string FirstLevelTitle 28 | { 29 | get 30 | { 31 | return (string)GetValue(FirstLevelTitleProperty); 32 | } 33 | 34 | set 35 | { 36 | SetValue(FirstLevelTitleProperty, value); 37 | } 38 | } 39 | 40 | 41 | /// 42 | /// The text of the second level title. 43 | /// A value of null will hide this title. 44 | /// 45 | public static readonly DependencyProperty SecondLevelTitleProperty = DependencyProperty.Register( 46 | nameof(SecondLevelTitle), typeof(string), typeof(StepTitleHeaderControl), new PropertyMetadata(null, null)); 47 | 48 | /// 49 | /// The text of the second level title. 50 | /// A value of null will hide this title. 51 | /// 52 | public string SecondLevelTitle 53 | { 54 | get 55 | { 56 | return (string)GetValue(SecondLevelTitleProperty); 57 | } 58 | 59 | set 60 | { 61 | SetValue(SecondLevelTitleProperty, value); 62 | } 63 | } 64 | 65 | /// 66 | /// Creates a new . 67 | /// 68 | public StepTitleHeaderControl() : base() { } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/BoolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace MaterialDesignExtensions.Converters 11 | { 12 | /// 13 | /// Converter to map a boolean to a . 14 | /// 15 | public class BoolToVisibilityConverter : IValueConverter 16 | { 17 | /// 18 | /// The visibility value if the argument is false. 19 | /// 20 | public Visibility FalseValue { get; set; } 21 | 22 | /// 23 | /// The visibility value if the argument is true. 24 | /// 25 | public Visibility TrueValue { get; set; } 26 | 27 | /// 28 | /// Creates a new . 29 | /// 30 | public BoolToVisibilityConverter() 31 | { 32 | FalseValue = Visibility.Collapsed; 33 | TrueValue = Visibility.Visible; 34 | } 35 | 36 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 37 | { 38 | if (value is bool && ((bool)value) == false) 39 | { 40 | return FalseValue; 41 | } 42 | else 43 | { 44 | return TrueValue; 45 | } 46 | } 47 | 48 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 49 | { 50 | return Binding.DoNothing; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/BooleanAndConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converter to apply boolean "and" operation. 13 | /// 14 | public class BooleanAndConverter : IMultiValueConverter 15 | { 16 | /// 17 | /// Creates a new . 18 | /// 19 | public BooleanAndConverter() { } 20 | 21 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | bool[] booleanValues = values.Select(value => value as bool?) 24 | .Where(b => b != null) 25 | .Select(b => b.Value) 26 | .ToArray(); 27 | 28 | if (booleanValues.Length > 0) 29 | { 30 | bool result = booleanValues[0]; 31 | 32 | for (int i = 1; i < booleanValues.Length && result; i++) 33 | { 34 | result = result && booleanValues[i]; 35 | } 36 | 37 | return result; 38 | } 39 | else 40 | { 41 | return false; 42 | } 43 | } 44 | 45 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 46 | { 47 | throw new NotImplementedException(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/BooleanOrConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converter to apply boolean "or" operation. 13 | /// 14 | public class BooleanOrConverter : IMultiValueConverter 15 | { 16 | /// 17 | /// Creates a new . 18 | /// 19 | public BooleanOrConverter() { } 20 | 21 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | bool result = false; 24 | 25 | if (values != null) 26 | { 27 | for (int i = 0; i < values.Length && !result; i++) 28 | { 29 | bool? b = values[i] as bool?; 30 | 31 | if (b != null) 32 | { 33 | result = result || b.Value; 34 | } 35 | } 36 | } 37 | 38 | return result; 39 | } 40 | 41 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 42 | { 43 | throw new NotImplementedException(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/BooleanOrToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace MaterialDesignExtensions.Converters 11 | { 12 | /// 13 | /// Converter to apply boolean "and" operation and map to a . 14 | /// 15 | public class BooleanOrToVisibilityConverter : IMultiValueConverter 16 | { 17 | private BooleanOrConverter m_booleanOrConverter; 18 | private BoolToVisibilityConverter m_boolToVisibilityConverter; 19 | 20 | /// 21 | /// The visibility value if the argument is false. 22 | /// 23 | public Visibility FalseValue 24 | { 25 | get 26 | { 27 | return m_boolToVisibilityConverter.FalseValue; 28 | } 29 | 30 | set 31 | { 32 | m_boolToVisibilityConverter.FalseValue = value; 33 | } 34 | } 35 | 36 | /// 37 | /// The visibility value if the argument is true. 38 | /// 39 | public Visibility TrueValue 40 | { 41 | get 42 | { 43 | return m_boolToVisibilityConverter.TrueValue; 44 | } 45 | 46 | set 47 | { 48 | m_boolToVisibilityConverter.TrueValue = value; 49 | } 50 | } 51 | 52 | /// 53 | /// Creates a new . 54 | /// 55 | public BooleanOrToVisibilityConverter() 56 | { 57 | m_booleanOrConverter = new BooleanOrConverter(); 58 | m_boolToVisibilityConverter = new BoolToVisibilityConverter(); 59 | } 60 | 61 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 62 | { 63 | bool b = (bool)m_booleanOrConverter.Convert(values, targetType, parameter, culture); 64 | 65 | return m_boolToVisibilityConverter.Convert(b, targetType, parameter, culture); 66 | } 67 | 68 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 69 | { 70 | throw new NotImplementedException(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/DateTimeAgoConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converter for displaying a past . 13 | /// 14 | public class DateTimeAgoConverter : IValueConverter 15 | { 16 | /// 17 | /// Creates a new . 18 | /// 19 | public DateTimeAgoConverter() { } 20 | 21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | if (value is DateTime dateTime) 24 | { 25 | DateTime now = DateTime.Now; 26 | TimeSpan timeSpan = now - dateTime; 27 | 28 | if (now.Date == dateTime.Date && timeSpan.TotalHours < 24) 29 | { 30 | return dateTime.ToShortTimeString(); 31 | } 32 | else 33 | { 34 | return dateTime.ToShortDateString(); 35 | } 36 | } 37 | else 38 | { 39 | return string.Empty; 40 | } 41 | } 42 | 43 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 44 | { 45 | return Binding.DoNothing; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/EmptyEnumerableToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Data; 9 | 10 | namespace MaterialDesignExtensions.Converters 11 | { 12 | /// 13 | /// Maps a null or empty to a boolean value. 14 | /// 15 | public class EmptyEnumerableToBoolConverter : IValueConverter 16 | { 17 | /// 18 | /// The boolean value, if the is empty or null. 19 | /// 20 | public bool EmptyValue { get; set; } 21 | 22 | /// 23 | /// Creates a new . 24 | /// 25 | public EmptyEnumerableToBoolConverter() { } 26 | 27 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | if (value is IEnumerable enumerable) 30 | { 31 | return enumerable.GetEnumerator().MoveNext() ? !EmptyValue : EmptyValue; 32 | } 33 | else 34 | { 35 | return EmptyValue; 36 | } 37 | } 38 | 39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 40 | { 41 | return Binding.DoNothing; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/EmptyEnumerableVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Data; 10 | 11 | namespace MaterialDesignExtensions.Converters 12 | { 13 | /// 14 | /// Maps a null or empty to a . 15 | /// 16 | public class EmptyEnumerableVisibilityConverter : IValueConverter 17 | { 18 | /// 19 | /// The visibility value of an empty or null . 20 | /// 21 | public Visibility EmptyVisibility { get; set; } 22 | 23 | /// 24 | /// The visibility value of a non empty . 25 | /// 26 | public Visibility NotEmptyVisibility { get; set; } 27 | 28 | /// 29 | /// Creates a new . 30 | /// 31 | public EmptyEnumerableVisibilityConverter() 32 | { 33 | EmptyVisibility = Visibility.Collapsed; 34 | NotEmptyVisibility = Visibility.Visible; 35 | } 36 | 37 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 38 | { 39 | if (value is IEnumerable enumerable) 40 | { 41 | return enumerable.GetEnumerator().MoveNext() ? NotEmptyVisibility : EmptyVisibility; 42 | } 43 | else 44 | { 45 | return Binding.DoNothing; 46 | } 47 | } 48 | 49 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 50 | { 51 | return Binding.DoNothing; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/FileSizeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converts a file size of bytes into a user friendly string. 13 | /// 14 | public class FileSizeConverter : IValueConverter 15 | { 16 | /// 17 | /// Creates a new . 18 | /// 19 | public FileSizeConverter() { } 20 | 21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | long length = -1; 24 | 25 | if (value is long) 26 | { 27 | length = (long)value; 28 | } 29 | else if (value is int) 30 | { 31 | length = (int)value; 32 | } 33 | 34 | if (length > -1) 35 | { 36 | double lengthBytes = length; 37 | double lengthKB = lengthBytes / 1000; 38 | double lengthMB = lengthKB / 1000; 39 | double lengthGB = lengthMB / 1000; 40 | 41 | if (lengthGB >= 1.0) 42 | { 43 | return lengthGB.ToString("0.#") + " GB"; 44 | } 45 | else if (lengthMB >= 1.0) 46 | { 47 | return lengthMB.ToString("0.#") + " MB"; 48 | } 49 | else if (lengthKB >= 1.0) 50 | { 51 | return lengthKB.ToString("0.#") + " KB"; 52 | } 53 | else 54 | { 55 | return length + " Bytes"; 56 | } 57 | } 58 | 59 | return Binding.DoNothing; 60 | } 61 | 62 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 63 | { 64 | return Binding.DoNothing; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/NotNullBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converts a not null value to true, otherwise false. 13 | /// A special logic for strings will be applied to handle empty or whitespace only strings like null values. 14 | /// 15 | public class NotNullBooleanConverter : IValueConverter 16 | { 17 | /// 18 | /// Creates a new . 19 | /// 20 | public NotNullBooleanConverter() { } 21 | 22 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | if (value is string str) 25 | { 26 | return !string.IsNullOrWhiteSpace(str); 27 | } 28 | else 29 | { 30 | return value != null; 31 | } 32 | } 33 | 34 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 35 | { 36 | return Binding.DoNothing; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/NotNullToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace MaterialDesignExtensions.Converters 11 | { 12 | /// 13 | /// Converts null or not null to a . 14 | /// 15 | public class NotNullToVisibilityConverter : IValueConverter 16 | { 17 | /// 18 | /// The visibility value if the argument is null. 19 | /// 20 | public Visibility NullValue { get; set; } 21 | 22 | /// 23 | /// Creates a new . 24 | /// 25 | public NotNullToVisibilityConverter() 26 | { 27 | NullValue = Visibility.Collapsed; 28 | } 29 | 30 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | return value == null ? NullValue : Visibility.Visible; 33 | } 34 | 35 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 36 | { 37 | return Binding.DoNothing; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/NullToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace MaterialDesignExtensions.Converters 11 | { 12 | /// 13 | /// Converts a null value to a . 14 | /// 15 | public class NullToVisibilityConverter : IValueConverter 16 | { 17 | /// 18 | /// The visibility value for a null value. 19 | /// 20 | public Visibility NullValue { get; set; } 21 | 22 | /// 23 | /// The visibility value for a not null value. 24 | /// 25 | public Visibility NotNullValue { get; set; } 26 | 27 | /// 28 | /// Creates a new . 29 | /// 30 | public NullToVisibilityConverter() 31 | { 32 | NullValue = Visibility.Collapsed; 33 | NotNullValue = Visibility.Visible; 34 | } 35 | 36 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 37 | { 38 | return value == null ? NullValue : NotNullValue; 39 | } 40 | 41 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 42 | { 43 | return Binding.DoNothing; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/ObjectCollectionToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Globalization; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Data; 11 | 12 | namespace MaterialDesignExtensions.Converters 13 | { 14 | /// 15 | /// Converts an empty collection to a . 16 | /// 17 | public class ObjectCollectionToVisibilityConverter : IValueConverter 18 | { 19 | /// 20 | /// The visibility value of an empty collection. 21 | /// 22 | public Visibility EmptyValue { get; set; } 23 | 24 | /// 25 | /// Creates a new . 26 | /// 27 | public ObjectCollectionToVisibilityConverter() 28 | { 29 | EmptyValue = Visibility.Collapsed; 30 | } 31 | 32 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 33 | { 34 | if (value != null 35 | && ((value is ICollection && ((ICollection)value).Count > 0) 36 | || (value is Collection && ((Collection)value).Count > 0))) 37 | { 38 | return Visibility.Visible; 39 | } 40 | else 41 | { 42 | return EmptyValue; 43 | } 44 | } 45 | 46 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 47 | { 48 | return Binding.DoNothing; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/ObjectHasTypeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Checks the type of the argument if it is of a specified type. 13 | /// 14 | public class ObjectHasTypeConverter : IMultiValueConverter 15 | { 16 | /// 17 | /// The fully qualified name of the type. 18 | /// 19 | public string FullTypeName { get; set; } 20 | 21 | /// 22 | /// Creates a new . 23 | /// 24 | public ObjectHasTypeConverter() { } 25 | 26 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 27 | { 28 | if (values != null && values.Length == 2) 29 | { 30 | string valueTypeFullName = values[0] != null ? values[0].GetType().FullName : "null"; 31 | 32 | string typeFullName = null; 33 | 34 | if (values[1] is Type type) 35 | { 36 | typeFullName = type.FullName; 37 | } 38 | else if (values[1] is string typeName) 39 | { 40 | typeFullName = typeName; 41 | } 42 | 43 | return valueTypeFullName == typeFullName; 44 | } 45 | else 46 | { 47 | return null; 48 | } 49 | } 50 | 51 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 52 | { 53 | return null; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/ObjectToTypeStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converts an object to its fully qualified type name. 13 | /// 14 | public class ObjectToTypeStringConverter : IValueConverter 15 | { 16 | /// 17 | /// Creates a new . 18 | /// 19 | public ObjectToTypeStringConverter() { } 20 | 21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | if (value != null) 24 | { 25 | return value.GetType().FullName; 26 | } 27 | else 28 | { 29 | return "null"; 30 | } 31 | } 32 | 33 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 34 | { 35 | // not used yet 36 | return Binding.DoNothing; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/StepIconTemplateConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | using MaterialDesignExtensions.Controls; 11 | using MaterialDesignExtensions.Model; 12 | using MaterialDesignExtensions.TemplateSelectors; 13 | 14 | namespace MaterialDesignExtensions.Converters 15 | { 16 | /// 17 | /// A converter triggering a for selecting an item for a step. 18 | /// This converter is necessary to react on changing data of the stepper and steps to call the selector logic again. 19 | /// 20 | public class StepIconTemplateConverter : IMultiValueConverter 21 | { 22 | private StepIconTemplateSelector _iconTemplateSelector; 23 | 24 | /// 25 | /// Creates a new . 26 | /// 27 | public StepIconTemplateConverter() 28 | { 29 | _iconTemplateSelector = new StepIconTemplateSelector(); 30 | } 31 | 32 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 33 | { 34 | if (values == null) 35 | { 36 | throw new ArgumentNullException(nameof(values)); 37 | } 38 | 39 | IStepper stepper = values[0] as IStepper; 40 | FrameworkElement element = values[1] as FrameworkElement; 41 | StepperStepViewModel stepViewModel = values[2] as StepperStepViewModel; 42 | 43 | return _iconTemplateSelector.SelectTemplate(stepper, element, stepViewModel); 44 | } 45 | 46 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 47 | { 48 | throw new NotImplementedException(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/UpperCaseConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converts a string to upper case. 13 | /// 14 | public class UpperCaseConverter : IValueConverter 15 | { 16 | /// 17 | /// Creates a new . 18 | /// 19 | public UpperCaseConverter() { } 20 | 21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | if (value != null && value is string str) 24 | { 25 | return str.ToUpper(); 26 | } 27 | else 28 | { 29 | return null; 30 | } 31 | } 32 | 33 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 34 | { 35 | return Binding.DoNothing; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/WindowCaptionButtonBaseConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Base class for the converters controlling the visibility and enabled state of window caption buttons. 13 | /// 14 | public abstract class WindowCaptionButtonBaseConverter : IMultiValueConverter 15 | { 16 | /// 17 | /// Identifier for the minimize caption button. 18 | /// 19 | public string MinimizeButtonName => "minimizeButton"; 20 | 21 | /// 22 | /// Identifier for the maximize/restore caption button. 23 | /// 24 | public string MaximizeRestoreButtonName => "maximizeRestoreButton"; 25 | 26 | /// 27 | /// Identifier for the close caption button. 28 | /// 29 | public string CloseButtonName => "closeButton"; 30 | 31 | /// 32 | /// Creates a new . 33 | /// 34 | public WindowCaptionButtonBaseConverter() { } 35 | 36 | public abstract object Convert(object[] values, Type targetType, object parameter, CultureInfo culture); 37 | 38 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 39 | { 40 | throw new NotImplementedException(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/WindowCaptionButtonEnabledConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace MaterialDesignExtensions.Converters 10 | { 11 | /// 12 | /// Converts a of a window into an enabled state of an according caption button. 13 | /// 14 | public class WindowCaptionButtonEnabledConverter : WindowCaptionButtonBaseConverter 15 | { 16 | /// 17 | /// Creates a new . 18 | /// 19 | public WindowCaptionButtonEnabledConverter() : base() { } 20 | 21 | public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | try 24 | { 25 | if (values != null && values.Length == 2) 26 | { 27 | string buttonName = (string)values[0]; 28 | ResizeMode resizeMode = (ResizeMode)values[1]; 29 | 30 | if (buttonName == CloseButtonName) 31 | { 32 | return true; 33 | } 34 | else if (buttonName == MinimizeButtonName) 35 | { 36 | return resizeMode != ResizeMode.NoResize; 37 | } 38 | else if (buttonName == MaximizeRestoreButtonName) 39 | { 40 | return resizeMode != ResizeMode.NoResize && resizeMode != ResizeMode.CanMinimize; 41 | } 42 | } 43 | } 44 | catch (Exception) 45 | { 46 | // use the default return value below 47 | } 48 | 49 | return true; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/WindowTitleBarIconVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace MaterialDesignExtensions.Converters 11 | { 12 | /// 13 | /// Converts a and icon of a window into a for the icon. 14 | /// 15 | public class WindowTitleBarIconVisibilityConverter : IMultiValueConverter 16 | { 17 | /// 18 | /// Creates a new . 19 | /// 20 | public WindowTitleBarIconVisibilityConverter() { } 21 | 22 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | try 25 | { 26 | if (values != null && values.Length == 2) 27 | { 28 | object icon = values[0]; 29 | WindowStyle windowStyle = (WindowStyle)values[1]; 30 | 31 | if (icon != null && (windowStyle == WindowStyle.SingleBorderWindow || windowStyle == WindowStyle.ThreeDBorderWindow)) 32 | { 33 | return Visibility.Visible; 34 | } 35 | else 36 | { 37 | return Visibility.Collapsed; 38 | } 39 | } 40 | } 41 | catch (Exception) 42 | { 43 | // use the default return value below 44 | } 45 | 46 | return Visibility.Visible; 47 | } 48 | 49 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 50 | { 51 | throw new NotImplementedException(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Converters/WindowTitleVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace MaterialDesignExtensions.Converters 11 | { 12 | /// 13 | /// Converts a of a window into a of the whole title bar. 14 | /// 15 | public class WindowTitleVisibilityConverter : IMultiValueConverter 16 | { 17 | /// 18 | /// Creates a new . 19 | /// 20 | public WindowTitleVisibilityConverter() { } 21 | 22 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | try 25 | { 26 | if (values != null && values.Length >= 1) 27 | { 28 | WindowStyle windowStyle = (WindowStyle)values[0]; 29 | 30 | if (windowStyle != WindowStyle.None) 31 | { 32 | return Visibility.Visible; 33 | } 34 | else 35 | { 36 | return Visibility.Collapsed; 37 | } 38 | } 39 | } 40 | catch (Exception) 41 | { 42 | // use the default return value below 43 | } 44 | 45 | return Visibility.Visible; 46 | } 47 | 48 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 49 | { 50 | throw new NotImplementedException(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.ar-DZ.Designer.cs: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.cs-cz.Designer.cs: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.de.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/43dbcc79dab3b3acba8b91f17796bd3d5f80de4f/MaterialDesignExtensions/Localization/Strings.de.Designer.cs -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.fr-FR.Designer.cs: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.ja-JP.Designer.cs: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.pt-BR.Designer.cs: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.ru-ru.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/43dbcc79dab3b3acba8b91f17796bd3d5f80de4f/MaterialDesignExtensions/Localization/Strings.ru-ru.Designer.cs -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.uz-Latn-UZ.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/43dbcc79dab3b3acba8b91f17796bd3d5f80de4f/MaterialDesignExtensions/Localization/Strings.uz-Latn-UZ.Designer.cs -------------------------------------------------------------------------------- /MaterialDesignExtensions/Localization/Strings.zh-CN.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/43dbcc79dab3b3acba8b91f17796bd3d5f80de4f/MaterialDesignExtensions/Localization/Strings.zh-CN.Designer.cs -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/DirectoryInfoItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | // use Pri.LongPath classes instead of System.IO for the MaterialDesignExtensions.LongPath build to support long file system paths on older Windows and .NET versions 9 | #if LONG_PATH 10 | using DirectoryInfo = Pri.LongPath.DirectoryInfo; 11 | #endif 12 | 13 | namespace MaterialDesignExtensions.Model 14 | { 15 | /// 16 | /// A directory item in the current directory list of file system controls. 17 | /// 18 | public class DirectoryInfoItem : FileSystemEntryItem 19 | { 20 | /// 21 | /// Creates a new . 22 | /// 23 | public DirectoryInfoItem() : base() { } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/DividerNavigationItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensions.Model 8 | { 9 | /// 10 | /// A divider line in a . 11 | /// 12 | public class DividerNavigationItem : NotSelectableNavigationItem 13 | { 14 | /// 15 | /// Creates a new . 16 | /// 17 | public DividerNavigationItem() : base() { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/FileInfoItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | // use Pri.LongPath classes instead of System.IO for the MaterialDesignExtensions.LongPath build to support long file system paths on older Windows and .NET versions 9 | #if LONG_PATH 10 | using FileInfo = Pri.LongPath.FileInfo; 11 | #endif 12 | 13 | namespace MaterialDesignExtensions.Model 14 | { 15 | /// 16 | /// A file item in the current directory list of file system controls. 17 | /// 18 | public class FileInfoItem : FileSystemEntryItem 19 | { 20 | /// 21 | /// Creates a new . 22 | /// 23 | public FileInfoItem() : base() { } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/FileSystemEntriesGroupHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MaterialDesignExtensions.Model 9 | { 10 | /// 11 | /// A group header in the items lists of file system controls to group directories and files. 12 | /// 13 | public class FileSystemEntriesGroupHeader : INotifyPropertyChanged 14 | { 15 | public event PropertyChangedEventHandler PropertyChanged; 16 | 17 | private string m_header; 18 | private bool m_showSeparator; 19 | 20 | /// 21 | /// The header label. 22 | /// 23 | public string Header 24 | { 25 | get 26 | { 27 | return m_header; 28 | } 29 | 30 | set 31 | { 32 | if (m_header != value) 33 | { 34 | m_header = value; 35 | 36 | OnPropertyChanged(nameof(Header)); 37 | } 38 | } 39 | } 40 | 41 | /// 42 | /// True, to display a separator above the label. 43 | /// 44 | public bool ShowSeparator 45 | { 46 | get 47 | { 48 | return m_showSeparator; 49 | } 50 | 51 | set 52 | { 53 | if (m_showSeparator != value) 54 | { 55 | m_showSeparator = value; 56 | 57 | OnPropertyChanged(nameof(ShowSeparator)); 58 | } 59 | } 60 | } 61 | 62 | /// 63 | /// Creates a new . 64 | /// 65 | public FileSystemEntriesGroupHeader() 66 | { 67 | m_header = null; 68 | m_showSeparator = false; 69 | } 70 | 71 | private void OnPropertyChanged(string propertyName) 72 | { 73 | if (PropertyChanged != null && !string.IsNullOrWhiteSpace(propertyName)) 74 | { 75 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/FirstLevelNavigationItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensions.Model 8 | { 9 | /// 10 | /// A first level navigation item of a . 11 | /// 12 | public class FirstLevelNavigationItem : NavigationItem 13 | { 14 | /// 15 | /// Creates a new . 16 | /// 17 | public FirstLevelNavigationItem() : base() { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/INavigationItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MaterialDesignExtensions.Model 9 | { 10 | /// 11 | /// The basic interface for an item of a . 12 | /// 13 | public interface INavigationItem : INotifyPropertyChanged 14 | { 15 | /// 16 | /// True, if the user can select this navigation item. 17 | /// 18 | bool IsSelectable { get; set; } 19 | 20 | /// 21 | /// True, if the navigation item is selected. 22 | /// 23 | bool IsSelected { get; set; } 24 | 25 | /// 26 | /// An optional callback method raised, when this navigation item will be selected. 27 | /// This API is necessary because events are not async. 28 | /// 29 | NavigationItemSelectedCallback NavigationItemSelectedCallback { get; set; } 30 | } 31 | 32 | /// 33 | /// The delegate for a method. 34 | /// 35 | /// 36 | /// 37 | public delegate object NavigationItemSelectedCallback(INavigationItem navigationItem); 38 | } 39 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/ITextBoxSuggestionsSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MaterialDesignExtensions.Model 9 | { 10 | /// 11 | /// Special version of for the controls. 12 | /// 13 | public interface ITextBoxSuggestionsSource : IAutocompleteSource 14 | { 15 | } 16 | 17 | /// 18 | /// Base class for text box suggestion sources providing default implementations of the necessary interface. 19 | /// 20 | public abstract class TextBoxSuggestionsSource : ITextBoxSuggestionsSource 21 | { 22 | /// 23 | /// Creates a new . 24 | /// 25 | public TextBoxSuggestionsSource() { } 26 | 27 | /// 28 | /// Does the search controls. 29 | /// 30 | /// The term to search for 31 | /// The items found for the search term 32 | public abstract IEnumerable Search(string searchTerm); 33 | 34 | /// 35 | /// Does the search for the controls. 36 | /// 37 | /// The term to search for 38 | /// The items found for the search term 39 | IEnumerable IAutocompleteSource.Search(string searchTerm) 40 | { 41 | return Search(searchTerm); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/NavigationItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace MaterialDesignExtensions.Model 9 | { 10 | /// 11 | /// An navigation item of a . 12 | /// 13 | public class NavigationItem : BaseNavigationItem 14 | { 15 | private object m_icon; 16 | private DataTemplate m_iconTemplate; 17 | private string m_label; 18 | 19 | /// 20 | /// The icon of this navigation item. 21 | /// 22 | public object Icon 23 | { 24 | get 25 | { 26 | return m_icon; 27 | } 28 | 29 | set 30 | { 31 | m_icon = value; 32 | 33 | OnPropertyChanged(nameof(Icon)); 34 | } 35 | } 36 | 37 | /// 38 | /// An optional template for the icon. 39 | /// 40 | public DataTemplate IconTemplate 41 | { 42 | get 43 | { 44 | return m_iconTemplate; 45 | } 46 | 47 | set 48 | { 49 | m_iconTemplate = value; 50 | 51 | OnPropertyChanged(nameof(IconTemplate)); 52 | } 53 | } 54 | 55 | /// 56 | /// The label of this navigation item. 57 | /// 58 | public string Label 59 | { 60 | get 61 | { 62 | return m_label; 63 | } 64 | 65 | set 66 | { 67 | m_label = value; 68 | 69 | OnPropertyChanged(nameof(Label)); 70 | } 71 | } 72 | 73 | /// 74 | /// Creates a new . 75 | /// 76 | public NavigationItem() 77 | { 78 | m_icon = null; 79 | m_label = null; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/NotSelectableNavigationItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensions.Model 8 | { 9 | /// 10 | /// The base class for not selectable items (headers, dividers) in a . 11 | /// 12 | public abstract class NotSelectableNavigationItem : BaseNavigationItem 13 | { 14 | /// 15 | /// True, if the user can select this navigation item. 16 | /// 17 | public override bool IsSelectable 18 | { 19 | get 20 | { 21 | return false; 22 | } 23 | 24 | set { } 25 | } 26 | 27 | /// 28 | /// True, if the navigation item is selected. 29 | /// 30 | public override bool IsSelected 31 | { 32 | get 33 | { 34 | return false; 35 | } 36 | 37 | set { } 38 | } 39 | 40 | /// 41 | /// The delegate for a method. 42 | /// 43 | /// 44 | public override NavigationItemSelectedCallback NavigationItemSelectedCallback 45 | { 46 | get 47 | { 48 | return null; 49 | } 50 | 51 | set { } 52 | } 53 | 54 | /// 55 | /// Creates a new . 56 | /// 57 | public NotSelectableNavigationItem() : base() { } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/SearchSuggestionItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MaterialDesignExtensions.Model 9 | { 10 | /// 11 | /// An item out of the suggestions of a search control. 12 | /// 13 | public class SearchSuggestionItem : INotifyPropertyChanged 14 | { 15 | public event PropertyChangedEventHandler PropertyChanged; 16 | 17 | private bool m_isFromHistory; 18 | private string m_suggestion; 19 | 20 | /// 21 | /// True, if this item is from an older search query. 22 | /// 23 | public bool IsFromHistory 24 | { 25 | get 26 | { 27 | return m_isFromHistory; 28 | } 29 | 30 | set 31 | { 32 | m_isFromHistory = value; 33 | 34 | OnPropertyChanged(nameof(IsFromHistory)); 35 | } 36 | } 37 | 38 | /// 39 | /// The label of this suggestion. 40 | /// 41 | public string Suggestion 42 | { 43 | get 44 | { 45 | return m_suggestion; 46 | } 47 | 48 | set 49 | { 50 | m_suggestion = value; 51 | 52 | OnPropertyChanged(nameof(Suggestion)); 53 | } 54 | } 55 | 56 | /// 57 | /// Creates a new . 58 | /// 59 | public SearchSuggestionItem() 60 | { 61 | m_isFromHistory = false; 62 | m_suggestion = null; 63 | } 64 | 65 | private void OnPropertyChanged(string propertyName) 66 | { 67 | if (PropertyChanged != null && !string.IsNullOrWhiteSpace(propertyName)) 68 | { 69 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/SearchSuggestionsSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensions.Model 8 | { 9 | /// 10 | /// Interface for a source for providing suggestions to search for. 11 | /// 12 | public interface ISearchSuggestionsSource 13 | { 14 | /// 15 | /// Returns historical search suggestions for an empty and focused search. 16 | /// 17 | /// 18 | IList GetSearchSuggestions(); 19 | 20 | /// 21 | /// Returns suggestions based on auto-completion. 22 | /// 23 | /// 24 | /// 25 | IList GetAutoCompletion(string searchTerm); 26 | } 27 | 28 | /// 29 | /// Default implementation of . 30 | /// 31 | public class SearchSuggestionsSource : ISearchSuggestionsSource 32 | { 33 | /// 34 | /// Creates a new . 35 | /// 36 | public SearchSuggestionsSource() { } 37 | 38 | /// 39 | /// Returns historical search suggestions for an empty and focused search. 40 | /// 41 | /// 42 | public IList GetAutoCompletion(string searchTerm) 43 | { 44 | return null; 45 | } 46 | 47 | /// 48 | /// Returns suggestions based on auto-completion. 49 | /// 50 | /// 51 | public IList GetSearchSuggestions() 52 | { 53 | return null; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/SecondLevelNavigationItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensions.Model 8 | { 9 | /// 10 | /// A second level navigation item of a . 11 | /// 12 | public class SecondLevelNavigationItem : NavigationItem 13 | { 14 | /// 15 | /// Creates a new . 16 | /// 17 | public SecondLevelNavigationItem() : base() { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/SpecialDirectory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using MaterialDesignThemes.Wpf; 9 | 10 | // use Pri.LongPath classes instead of System.IO for the MaterialDesignExtensions.LongPath build to support long file system paths on older Windows and .NET versions 11 | #if LONG_PATH 12 | using DirectoryInfo = Pri.LongPath.DirectoryInfo; 13 | #endif 14 | 15 | namespace MaterialDesignExtensions.Model 16 | { 17 | /// 18 | /// A helper class to provide special locations (user folders etc.) inside the file system controls. 19 | /// 20 | public class SpecialDirectory 21 | { 22 | private string m_label; 23 | 24 | /// 25 | /// The icon on the user inferface for this special location. 26 | /// 27 | public PackIconKind Icon { get; set; } 28 | 29 | /// 30 | /// The object with the information for this special location. 31 | /// 32 | public DirectoryInfo Info { get; set; } 33 | 34 | /// 35 | /// The label the user inferface for this special location. 36 | /// 37 | public string Label 38 | { 39 | get 40 | { 41 | if (!string.IsNullOrWhiteSpace(m_label)) 42 | { 43 | return m_label; 44 | } 45 | else 46 | { 47 | return Info?.Name; 48 | } 49 | } 50 | 51 | set 52 | { 53 | m_label = value; 54 | } 55 | } 56 | 57 | /// 58 | /// Creates a new . 59 | /// 60 | public SpecialDirectory() { } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/SpecialDrive.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using MaterialDesignThemes.Wpf; 9 | 10 | namespace MaterialDesignExtensions.Model 11 | { 12 | /// 13 | /// A helper class to provide drives inside the file system controls. 14 | /// 15 | public class SpecialDrive 16 | { 17 | /// 18 | /// The icon on the user inferface for this special location. 19 | /// 20 | public PackIconKind Icon { get; set; } 21 | 22 | /// 23 | /// /// 24 | /// The label the user inferface for this special location. 25 | /// 26 | /// 27 | public string Label { get; set; } 28 | 29 | /// 30 | /// The object with the information for this special location. 31 | /// 32 | public DriveInfo Info { get; set; } 33 | 34 | /// 35 | /// Creates a new . 36 | /// 37 | public SpecialDrive() { } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/StepTitleHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MaterialDesignExtensions.Model 9 | { 10 | /// 11 | /// Convenience class for building a text header with a first and a second level header. 12 | /// The corresponding data template is already implemented and will be automatically applied. 13 | /// 14 | public class StepTitleHeader : INotifyPropertyChanged 15 | { 16 | public event PropertyChangedEventHandler PropertyChanged; 17 | 18 | private string m_firstLevelTitle; 19 | private string m_secondLevelTitle; 20 | 21 | /// 22 | /// The text of the first level title. 23 | /// A value of null will hide this title. 24 | /// 25 | public string FirstLevelTitle 26 | { 27 | get 28 | { 29 | return m_firstLevelTitle; 30 | } 31 | 32 | set 33 | { 34 | m_firstLevelTitle = value; 35 | 36 | OnPropertyChanged(nameof(FirstLevelTitle)); 37 | } 38 | } 39 | 40 | /// 41 | /// The text of the second level title beneath the first level title. 42 | /// A value of null will hide the this title. 43 | /// It uses a smaller font size. 44 | /// 45 | public string SecondLevelTitle 46 | { 47 | get 48 | { 49 | return m_secondLevelTitle; 50 | } 51 | 52 | set 53 | { 54 | m_secondLevelTitle = value; 55 | 56 | OnPropertyChanged(nameof(SecondLevelTitle)); 57 | } 58 | } 59 | 60 | /// 61 | /// Creates a new . 62 | /// 63 | public StepTitleHeader() 64 | { 65 | m_firstLevelTitle = null; 66 | m_secondLevelTitle = null; 67 | } 68 | 69 | private void OnPropertyChanged(string propertyName) 70 | { 71 | if (PropertyChanged != null && !string.IsNullOrWhiteSpace(propertyName)) 72 | { 73 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Model/SubheaderNavigationItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensions.Model 8 | { 9 | /// 10 | /// A header item of a . 11 | /// 12 | public class SubheaderNavigationItem : NotSelectableNavigationItem 13 | { 14 | private string m_subheader; 15 | 16 | /// 17 | /// The label of this header. 18 | /// 19 | public string Subheader 20 | { 21 | get 22 | { 23 | return m_subheader; 24 | } 25 | 26 | set 27 | { 28 | m_subheader = value; 29 | 30 | OnPropertyChanged(nameof(Subheader)); 31 | } 32 | } 33 | 34 | /// 35 | /// Creates a new . 36 | /// 37 | public SubheaderNavigationItem() 38 | : base() 39 | { 40 | m_subheader = null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.42000 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MaterialDesignExtensions.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/TemplateSelectors/FileSystemEntryInfoTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | // use Pri.LongPath classes instead of System.IO for the MaterialDesignExtensions.LongPath build to support long file system paths on older Windows and .NET versions 11 | #if LONG_PATH 12 | using DirectoryInfo = Pri.LongPath.DirectoryInfo; 13 | using FileInfo = Pri.LongPath.FileInfo; 14 | #endif 15 | 16 | namespace MaterialDesignExtensions.TemplateSelectors 17 | { 18 | internal class FileSystemEntryInfoTemplateSelector : DataTemplateSelector 19 | { 20 | public FileSystemEntryInfoTemplateSelector() : base() { } 21 | 22 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 23 | { 24 | if (container is FrameworkElement element && item != null) 25 | { 26 | if (item is DirectoryInfo) 27 | { 28 | return element.FindResource("directoryInfoInfoTemplate") as DataTemplate; 29 | } 30 | else if (item is FileInfo) 31 | { 32 | return element.FindResource("fileInfoInfoTemplate") as DataTemplate; 33 | } 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/TemplateSelectors/FileSystemEntryItemIconTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media.Imaging; 9 | 10 | using MaterialDesignThemes.Wpf; 11 | 12 | namespace MaterialDesignExtensions.TemplateSelectors 13 | { 14 | internal class FileSystemEntryItemIconTemplateSelector : DataTemplateSelector 15 | { 16 | public FileSystemEntryItemIconTemplateSelector() : base() { } 17 | 18 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 19 | { 20 | if (container is FrameworkElement element && item != null) 21 | { 22 | if (item is PackIconKind) 23 | { 24 | return element.FindResource("fileSystemEntryItemPackIconTemplate") as DataTemplate; 25 | } 26 | else if (item is BitmapImage) 27 | { 28 | return element.FindResource("fileSystemEntryItemImageIconTemplate") as DataTemplate; 29 | } 30 | else if (item is Converters.AsyncImageTask) 31 | { 32 | return element.FindResource("fileSystemEntryItemAsyncImageTaskIconTemplate") as DataTemplate; 33 | } 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/TemplateSelectors/FileSystemEntryItemTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | using MaterialDesignExtensions.Model; 10 | 11 | namespace MaterialDesignExtensions.TemplateSelectors 12 | { 13 | internal class FileSystemEntryItemTemplateSelector : DataTemplateSelector 14 | { 15 | public bool ForMultipleSelection { get; set; } 16 | 17 | public FileSystemEntryItemTemplateSelector() 18 | : base() 19 | { 20 | ForMultipleSelection = false; 21 | } 22 | 23 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 24 | { 25 | if (container is FrameworkElement element && item != null) 26 | { 27 | if (item is DirectoryInfoItem) 28 | { 29 | return element.FindResource("directoryInfoItemTemplate") as DataTemplate; 30 | } 31 | else if (item is FileInfoItem) 32 | { 33 | if (ForMultipleSelection) 34 | { 35 | return element.FindResource("fileInfoItemMultipleTemplate") as DataTemplate; 36 | } 37 | else 38 | { 39 | return element.FindResource("fileInfoItemTemplate") as DataTemplate; 40 | } 41 | } 42 | else if (item is FileSystemEntriesGroupHeader) 43 | { 44 | return element.FindResource("fileSystemEntriesGroupHeaderTemplate") as DataTemplate; 45 | } 46 | } 47 | 48 | return null; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/TemplateSelectors/FileSystemInfoIconTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media.Imaging; 9 | 10 | using MaterialDesignThemes.Wpf; 11 | 12 | namespace MaterialDesignExtensions.TemplateSelectors 13 | { 14 | internal class FileSystemInfoIconTemplateSelector : DataTemplateSelector 15 | { 16 | public FileSystemInfoIconTemplateSelector() : base() { } 17 | 18 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 19 | { 20 | if (container is FrameworkElement element && item != null) 21 | { 22 | if (item is PackIconKind) 23 | { 24 | return element.FindResource("fileSystemInfoPackIconTemplate") as DataTemplate; 25 | } 26 | else if (item is BitmapImage) 27 | { 28 | return element.FindResource("fileSystemInfoImageTemplate") as DataTemplate; 29 | } 30 | else if (item is Converters.AsyncImageTask) 31 | { 32 | return element.FindResource("fileSystemInfoAsyncImageTaskTemplate") as DataTemplate; 33 | } 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/TemplateSelectors/HorizontalStepperHeaderTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | using MaterialDesignExtensions.Model; 10 | 11 | namespace MaterialDesignExtensions.TemplateSelectors 12 | { 13 | internal class HorizontalStepperHeaderTemplateSelector : DataTemplateSelector 14 | { 15 | public HorizontalStepperHeaderTemplateSelector() : base() { } 16 | 17 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 18 | { 19 | FrameworkElement element = container as FrameworkElement; 20 | StepperStepViewModel step = item as StepperStepViewModel; 21 | 22 | if (element != null && step != null) 23 | { 24 | if (step.IsFirstStep) 25 | { 26 | return element.FindResource("firstHorizontalStepHeaderTemplate") as DataTemplate; 27 | } 28 | else if (step.IsLastStep) 29 | { 30 | return element.FindResource("lastHorizontalStepHeaderTemplate") as DataTemplate; 31 | } 32 | else 33 | { 34 | return element.FindResource("intermediateHorizontalStepHeaderTemplate") as DataTemplate; 35 | } 36 | } 37 | 38 | return null; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/TemplateSelectors/NavigationItemKindTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | using MaterialDesignExtensions.Model; 10 | 11 | namespace MaterialDesignExtensions.TemplateSelectors 12 | { 13 | internal class NavigationItemKindTemplateSelector : DataTemplateSelector 14 | { 15 | public NavigationItemKindTemplateSelector() : base() { } 16 | 17 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 18 | { 19 | if (container is FrameworkElement element && item is INavigationItem navigationItem) 20 | { 21 | if (navigationItem.IsSelectable) 22 | { 23 | return element.FindResource("selectableNavigationItemTemplate") as DataTemplate; 24 | } 25 | else 26 | { 27 | return element.FindResource("notSelectableNavigationItemTemplate") as DataTemplate; 28 | } 29 | } 30 | 31 | return null; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/ExtendedTheme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Media; 7 | 8 | using MaterialDesignThemes.Wpf; 9 | 10 | namespace MaterialDesignExtensions.Themes 11 | { 12 | public class ExtendedTheme : Theme, IExtendedTheme 13 | { 14 | public static IExtendedBaseTheme ExtendedLightTheme { get; } = new MaterialDesignExtendedLightTheme(); 15 | 16 | public static IExtendedBaseTheme ExtendedDarkTheme { get; } = new MaterialDesignExtendedDarkTheme(); 17 | 18 | public Color NavigationItemIcon { get; set; } 19 | 20 | public Color NavigationItemText { get; set; } 21 | 22 | public Color NavigationItemSubheader { get; set; } 23 | 24 | public Color StepperInactiveStep { get; set; } 25 | 26 | public Color StepperActiveStep { get; set; } 27 | 28 | public Color StepperSeparator { get; set; } 29 | 30 | public static ExtendedTheme Create(IExtendedBaseTheme baseTheme, Color primary, Color accent) 31 | { 32 | if (baseTheme == null) 33 | { 34 | throw new ArgumentNullException(nameof(baseTheme)); 35 | } 36 | 37 | ExtendedTheme theme = new ExtendedTheme(); 38 | 39 | theme.SetBaseTheme(baseTheme); 40 | theme.SetPrimaryColor(primary); 41 | theme.SetSecondaryColor(accent); 42 | 43 | return theme; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/ExtendedThemeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using MaterialDesignThemes.Wpf; 8 | 9 | namespace MaterialDesignExtensions.Themes 10 | { 11 | public static class ExtendedThemeExtensions 12 | { 13 | public static IExtendedBaseTheme GetExtendedBaseTheme(this BaseTheme baseTheme) 14 | { 15 | switch (baseTheme) 16 | { 17 | case BaseTheme.Dark: 18 | return ExtendedTheme.ExtendedDarkTheme; 19 | 20 | case BaseTheme.Light: 21 | return ExtendedTheme.ExtendedLightTheme; 22 | 23 | default: 24 | throw new InvalidOperationException(); 25 | } 26 | } 27 | 28 | public static void SetBaseTheme(this IExtendedTheme theme, IExtendedBaseTheme baseTheme) 29 | { 30 | // call implementation of MaterialDesignThemes 31 | theme.SetBaseTheme((IBaseTheme)baseTheme); 32 | 33 | // set extended properties of the theme 34 | theme.NavigationItemIcon = baseTheme.MaterialDesignNavigationItemIcon; 35 | theme.NavigationItemText = baseTheme.MaterialDesignNavigationItemText; 36 | theme.NavigationItemSubheader = baseTheme.MaterialDesignNavigationItemSubheader; 37 | theme.StepperInactiveStep = baseTheme.MaterialDesignStepperInactiveStep; 38 | theme.StepperActiveStep = baseTheme.MaterialDesignStepperActiveStep; 39 | theme.StepperSeparator = baseTheme.MaterialDesignStepperSeparator; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/IExtendedBaseTheme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Media; 7 | 8 | using MaterialDesignThemes.Wpf; 9 | 10 | namespace MaterialDesignExtensions.Themes 11 | { 12 | public interface IExtendedBaseTheme : IBaseTheme 13 | { 14 | Color MaterialDesignNavigationItemIcon { get; } 15 | 16 | Color MaterialDesignNavigationItemText { get; } 17 | 18 | Color MaterialDesignNavigationItemSubheader { get; } 19 | 20 | Color MaterialDesignStepperInactiveStep { get; } 21 | 22 | Color MaterialDesignStepperActiveStep { get; } 23 | 24 | Color MaterialDesignStepperSeparator { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/IExtendedTheme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Media; 7 | 8 | using MaterialDesignThemes.Wpf; 9 | 10 | namespace MaterialDesignExtensions.Themes 11 | { 12 | public interface IExtendedTheme : ITheme 13 | { 14 | Color NavigationItemIcon { get; set; } 15 | 16 | Color NavigationItemText { get; set; } 17 | 18 | Color NavigationItemSubheader { get; set; } 19 | 20 | Color StepperInactiveStep { get; set; } 21 | 22 | Color StepperActiveStep { get; set; } 23 | 24 | Color StepperSeparator { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/MaterialDesignDarkTheme.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/MaterialDesignExtendedDarkTheme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Media; 7 | 8 | using MaterialDesignThemes.Wpf; 9 | 10 | namespace MaterialDesignExtensions.Themes 11 | { 12 | public class MaterialDesignExtendedDarkTheme : MaterialDesignDarkTheme, IExtendedBaseTheme 13 | { 14 | public Color MaterialDesignNavigationItemIcon { get; } = (Color)ColorConverter.ConvertFromString("#8AFFFFFF"); 15 | 16 | public Color MaterialDesignNavigationItemText { get; } = (Color)ColorConverter.ConvertFromString("#DEFFFFFF"); 17 | 18 | public Color MaterialDesignNavigationItemSubheader { get; } = (Color)ColorConverter.ConvertFromString("#8AFFFFFF"); 19 | 20 | public Color MaterialDesignStepperInactiveStep { get; } = (Color)ColorConverter.ConvertFromString("#61FFFFFF"); 21 | 22 | public Color MaterialDesignStepperActiveStep { get; } = (Color)ColorConverter.ConvertFromString("#DDFFFFFF"); 23 | 24 | public Color MaterialDesignStepperSeparator { get; } = (Color)ColorConverter.ConvertFromString("#1FFFFFFF"); 25 | 26 | public MaterialDesignExtendedDarkTheme() : base() { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/MaterialDesignExtendedLightTheme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Media; 7 | 8 | using MaterialDesignThemes.Wpf; 9 | 10 | namespace MaterialDesignExtensions.Themes 11 | { 12 | public class MaterialDesignExtendedLightTheme : MaterialDesignLightTheme, IExtendedBaseTheme 13 | { 14 | public Color MaterialDesignNavigationItemIcon { get; } = (Color)ColorConverter.ConvertFromString("#8A000000"); 15 | 16 | public Color MaterialDesignNavigationItemText { get; } = (Color)ColorConverter.ConvertFromString("#DE000000"); 17 | 18 | public Color MaterialDesignNavigationItemSubheader { get; } = (Color)ColorConverter.ConvertFromString("#8A000000"); 19 | 20 | public Color MaterialDesignStepperInactiveStep { get; } = (Color)ColorConverter.ConvertFromString("#61000000"); 21 | 22 | public Color MaterialDesignStepperActiveStep { get; } = (Color)ColorConverter.ConvertFromString("#DD000000"); 23 | 24 | public Color MaterialDesignStepperSeparator { get; } = (Color)ColorConverter.ConvertFromString("#1F000000"); 25 | 26 | public MaterialDesignExtendedLightTheme() : base() { } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/Themes/MaterialDesignLightTheme.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /MaterialDesignExtensions/key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spiegelp/MaterialDesignExtensions/43dbcc79dab3b3acba8b91f17796bd3d5f80de4f/MaterialDesignExtensions/key.snk -------------------------------------------------------------------------------- /MaterialDesignExtensionsBuildUtility/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsBuildUtility/BuildConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensionsBuildUtility 8 | { 9 | public class BuildConfiguration 10 | { 11 | public string Name { get; } 12 | 13 | public string BuildDirectory { get; } 14 | 15 | public string NuspecFilename { get; } 16 | 17 | public BuildConfiguration(string name, string buildDirectory, string nuspecFilename) 18 | { 19 | Name = name; 20 | BuildDirectory = buildDirectory; 21 | NuspecFilename = nuspecFilename; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsBuildUtility/BuildException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensionsBuildUtility 8 | { 9 | public class BuildException : Exception 10 | { 11 | public BuildException(string message) : base(message) { } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsBuildUtility/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MaterialDesignExtensionsBuildUtility 8 | { 9 | public class Configuration 10 | { 11 | public string MsBuildExePath { get; set; } 12 | 13 | public string NuGetExePath { get; set; } 14 | 15 | public string RepositoryBaseDirectory { get; set; } 16 | 17 | public string ProjectDirectory { get; set; } 18 | 19 | public string ProjectFile { get; set; } 20 | 21 | public BuildConfiguration[] BuildConfigurations { get; set; } 22 | 23 | public string PackageDirectory { get; set; } 24 | 25 | public Configuration() { } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsBuildUtility/MaterialDesignExtensionsBuildUtility.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Exe 6 | net7.0 7 | false 8 | 9 | 10 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsBuildUtility/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die einer Assembly zugeordnet sind. 8 | [assembly: AssemblyTitle("MaterialDesignExtensionsBuildUtility")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MaterialDesignExtensionsBuildUtility")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly 18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("2e40d411-ce99-489e-a1e4-9f28a1399ca1")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsBuildUtility/Readme.md: -------------------------------------------------------------------------------- 1 | A small utility app to automate builds and package creation for new releases of Material Design Extensions. -------------------------------------------------------------------------------- /MaterialDesignExtensionsDemo/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsDemo/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Threading; 3 | using System.Windows; 4 | 5 | namespace MaterialDesignExtensionsDemo 6 | { 7 | public partial class App : Application 8 | { 9 | protected override void OnStartup(StartupEventArgs args) 10 | { 11 | // change the culture to test localized resource files for display strings 12 | /*Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us"); 13 | Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");*/ 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsDemo/Controls/AppBarControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace MaterialDesignExtensionsDemo.Controls 17 | { 18 | public partial class AppBarControl : UserControl 19 | { 20 | public AppBarControl() 21 | { 22 | InitializeComponent(); 23 | } 24 | 25 | private void BackButtonClickHandler(object sender, RoutedEventArgs args) 26 | { 27 | // do something after clicking the back button 28 | // or use the AppBar.BackCommand to get notified about a click on the back button 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsDemo/Controls/AutocompleteControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace MaterialDesignExtensionsDemo.Controls 17 | { 18 | public partial class AutocompleteControl : UserControl 19 | { 20 | public AutocompleteControl() 21 | { 22 | InitializeComponent(); 23 | } 24 | 25 | private void ClearSelectionButtonClickHandler(object sender, RoutedEventArgs args) 26 | { 27 | autocomplete.ClearSelection(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsDemo/Controls/AutocompleteInTabControlControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace MaterialDesignExtensionsDemo.Controls 17 | { 18 | public partial class AutocompleteInTabControlControl : UserControl 19 | { 20 | public AutocompleteInTabControlControl() 21 | { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsDemo/Controls/BusyOverlayControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | using MaterialDesignExtensionsDemo.ViewModel; 16 | 17 | namespace MaterialDesignExtensionsDemo.Controls 18 | { 19 | public partial class BusyOverlayControl : UserControl 20 | { 21 | public BusyOverlayControl() 22 | { 23 | InitializeComponent(); 24 | } 25 | 26 | private async void BeBusyButtonClickHandler(object sender, RoutedEventArgs args) 27 | { 28 | await ((BusyOverlayViewModel)DataContext).BeBusyAsync(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MaterialDesignExtensionsDemo/Controls/FileSystemDialogControl.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |