├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── documentation-issue.md │ └── feature_request.md └── Images │ ├── ControlGalleryExample1.png │ ├── ControlGalleryExample2.png │ ├── ControlGalleryExample3.png │ ├── DllArchitecture.png │ └── MainExample.png ├── .gitignore ├── LICENSE ├── README.md ├── build ├── azure-pipelines.yml └── generate-docs.ps1 ├── doc ├── articles │ ├── getting-started │ │ ├── installation.md │ │ └── style-naming-format.md │ ├── introduction.md │ └── toc.yml ├── docfx.json ├── filterConfig.yml └── impressum.md └── src ├── .editorconfig ├── Celestial.UIToolkit.Core.Tests ├── Celestial.UIToolkit.Core.Tests.csproj ├── Converters │ ├── BooleanToVisibilityConverterTests.cs │ ├── ColorToSolidColorBrushConverterTests.cs │ ├── DoubleToCornerRadiusConverterTests.cs │ ├── GetTypeConverterTests.cs │ ├── GroupConverterTests.cs │ ├── InvertBooleanConverterTests.cs │ ├── InvertingConverterTests.cs │ ├── MathOperationConverterTests.cs │ ├── NegateValueConverterTests.cs │ ├── NullToVisibilityConverterTests.cs │ ├── StringToVisibilityConverterTests.cs │ ├── ThicknessSidePickerConverterTests.cs │ └── ValueConverterTests.cs ├── Extensions │ ├── ArrayExtensionsTests.cs │ ├── ArraySegmentExtensionsTests.cs │ └── EnumerableExtensionsTests.cs ├── ItemsSourceCollectionTests.cs ├── Media │ └── Animations │ │ ├── AnimationBaseTests.cs │ │ ├── AnimationUsingKeyFramesBaseTests.cs │ │ ├── EasingFromToByAnimationTests.cs │ │ ├── FromToByAnimationTests.cs │ │ └── Mocks │ │ ├── ControllableAnimationClock.cs │ │ ├── DoubleAnimationUsingKeyFrames.cs │ │ ├── FromToByDoubleAnimation.cs │ │ └── SimpleDoubleAnimation.cs ├── Resources │ ├── SampleDictionary.xaml │ └── SampleDictionaryKeys.cs └── Xaml │ ├── BindingExtensionsTests.cs │ ├── DependencyProperties.cs │ ├── GridUnitExtensionTests.cs │ ├── MergeStylesExtensionTests.cs │ ├── MockedServiceProvider.cs │ └── SharedResourceDictionaryTests.cs ├── Celestial.UIToolkit.Core ├── Celestial.UIToolkit.Core.csproj ├── Common │ └── Singleton.cs ├── Converters │ ├── BooleanToVisibilityConverter.cs │ ├── ColorToSolidColorBrushConverter.cs │ ├── DoubleToCornerRadiusConverter.cs │ ├── GetTypeConverter.cs │ ├── GroupConverter.cs │ ├── InvertBooleanConverter.cs │ ├── InvertingConverter.cs │ ├── MathOperationConverter.cs │ ├── NegateValueConverter.cs │ ├── NullToVisibilityConverter.cs │ ├── ThicknessSidePickerConverter.cs │ └── ValueConverter.cs ├── DesignMode.cs ├── Extensions │ ├── ArrayExtensions.cs │ ├── ArraySegmentExtensions.cs │ ├── DependencyObjectExtensions.cs │ ├── DependencyPropertyExtensions.cs │ ├── EnumerableExtensions.cs │ └── FrameworkElementExtensions.cs ├── ItemsSourceCollection.cs ├── Media │ └── Animations │ │ ├── AnimationBase │ │ ├── AnimationBase.cs │ │ ├── EasingFromToByAnimationBase.cs │ │ ├── FromToByAnimationBase.cs │ │ └── IAnimationClock.cs │ │ ├── AnimationHelper │ │ ├── BrushAnimationHelper.cs │ │ ├── ColorAnimationHelper.cs │ │ ├── DoubleAnimationHelper.cs │ │ ├── IAnimationHelper.cs │ │ └── PointAnimationHelper.cs │ │ ├── AnimationUsingKeyFramesBase │ │ ├── AnimationUsingKeyFramesBase.cs │ │ ├── IInterpolatingKeyFrame.cs │ │ ├── ISegmentLengthProvider.cs │ │ ├── KeyFrameBase.cs │ │ ├── KeyFrameResolver.cs │ │ ├── ResolvedKeyFrame.cs │ │ └── ResolvedKeyFrameCollectionExtensions.cs │ │ └── BrushAnimation │ │ ├── BrushAnimation.cs │ │ ├── BrushAnimationInputTransformer.cs │ │ ├── BrushAnimationUsingKeyFrames.cs │ │ ├── BrushAnimationValidator.cs │ │ ├── BrushKeyFrameCollection.cs │ │ ├── DiscreteBrushKeyFrame.cs │ │ ├── EasingBrushKeyFrame.cs │ │ ├── LinearBrushKeyFrame.cs │ │ └── SplineBrushKeyFrame.cs ├── Properties │ └── AssemblyInfo.cs ├── TraceSources.cs └── Xaml │ ├── BindingExtensions.cs │ ├── BindingProxy.cs │ ├── DesignTimeOnlyResourceDictionary.cs │ ├── EnumBindingSourceExtension.cs │ ├── ExtendedVisualStateManager │ ├── AnimationVisualStateSwitcher.cs │ ├── ExtendedVisualState.cs │ ├── ExtendedVisualStateManager.cs │ ├── SetterVisualStateSwitcher.cs │ ├── VisualStateGroupExtensions.cs │ ├── VisualTransitionExtensions.cs │ └── VisualTransitionProvider.cs │ ├── GridUnitExtension.cs │ ├── MarginHelper.cs │ ├── MergeStylesExtension.cs │ ├── SharedResourceDictionary.cs │ ├── ThemeChangedEventArgs.cs │ ├── ThemeManager.cs │ └── ThemeResourceDictionary.cs ├── Celestial.UIToolkit.Tests ├── Celestial.UIToolkit.Tests.csproj ├── Controls │ ├── ControlTestHelper.cs │ └── NavigationViewTests │ │ ├── DisplayModeTests.cs │ │ └── MenuItemsTests.cs └── app.config ├── Celestial.UIToolkit.sln ├── Celestial.UIToolkit ├── Celestial.UIToolkit.csproj ├── Controls │ ├── Card │ │ ├── Card.GeneratedProperties.cs │ │ ├── Card.GeneratedProperties.tt │ │ └── Card.cs │ ├── ClippingBorder.cs │ ├── CommonVisualStatesControl.cs │ ├── ConstructedFrameworkElement.cs │ ├── ExtendedListView.cs │ ├── Icon │ │ ├── IconElement.cs │ │ └── PathIcon.cs │ ├── ManipulationBoundaryFeedbackAwareContentControl.cs │ ├── NavigationView │ │ ├── Items │ │ │ └── NavigationViewItem.cs │ │ ├── NavigationView.DisplayMode.cs │ │ ├── NavigationView.Header.cs │ │ ├── NavigationView.Items.cs │ │ ├── NavigationView.Pane.cs │ │ ├── NavigationView.PaneButtons.cs │ │ ├── NavigationView.PaneCustomContent.cs │ │ ├── NavigationView.PaneFooter.cs │ │ ├── NavigationView.PaneHeader.cs │ │ ├── NavigationView.VisualStates.cs │ │ ├── NavigationView.cs │ │ ├── NavigationViewDisplayMode.cs │ │ ├── NavigationViewDisplayModeChangedEventArgs.cs │ │ ├── NavigationViewItemEventArgs.cs │ │ └── NavigationViewListView.cs │ ├── PlaceholderOverlay │ │ ├── PlaceholderDisplayType.cs │ │ ├── PlaceholderOverlay.Properties.cs │ │ └── PlaceholderOverlay.cs │ ├── RelativeCanvas.cs │ ├── Ripple.cs │ ├── SelectionIndicator.cs │ ├── ShadowControls │ │ ├── DirectionalThemeShadow.cs │ │ ├── DropShadowDecorator.Properties.cs │ │ ├── DropShadowDecorator.cs │ │ ├── ThemeShadow.Properties.cs │ │ ├── ThemeShadow.cs │ │ └── ThemeShadowPresenter.cs │ ├── SplitView │ │ ├── SplitVIew.cs │ │ ├── SplitView.Events.cs │ │ ├── SplitView.Properties.cs │ │ ├── SplitView.VisualStates.cs │ │ ├── SplitViewDisplayMode.cs │ │ └── SplitViewPanePlacement.cs │ ├── ToggleSwitch │ │ ├── ToggleSwitch.Properties.cs │ │ └── ToggleSwitch.cs │ └── WindowCommands.cs ├── Icons │ ├── All.xaml │ ├── Badges.xaml │ ├── ControlParts.xaml │ └── Weather.xaml ├── Properties │ └── AssemblyInfo.cs ├── Styles │ ├── Accents │ │ └── Default.xaml │ ├── Bundle.xaml │ ├── Controls │ │ ├── Button.xaml │ │ ├── Card.xaml │ │ ├── CheckBox.xaml │ │ ├── ComboBox.xaml │ │ ├── ContentControl.xaml │ │ ├── Expander.xaml │ │ ├── GroupBox.xaml │ │ ├── IconElements.xaml │ │ ├── Label.xaml │ │ ├── ListBox.xaml │ │ ├── ListView.xaml │ │ ├── ManipulationBoundaryFeedbackAwareContentControl.xaml │ │ ├── Menu.xaml │ │ ├── NavigationView.xaml │ │ ├── PlaceholderOverlay.xaml │ │ ├── ProgressBar.xaml │ │ ├── RadioButton.xaml │ │ ├── Ripple.xaml │ │ ├── ScrollBar.xaml │ │ ├── ScrollViewer.xaml │ │ ├── SelectionIndicator.xaml │ │ ├── Separator.xaml │ │ ├── Slider.xaml │ │ ├── SplitView.xaml │ │ ├── StatusBar.xaml │ │ ├── TabControl.xaml │ │ ├── TextBlock.xaml │ │ ├── TextBox.xaml │ │ ├── Thumb.xaml │ │ ├── ToggleSwitch.xaml │ │ ├── ToolBar.xaml │ │ ├── ToolTip.xaml │ │ ├── TreeView.xaml │ │ ├── Window.xaml │ │ └── _Template.xaml │ ├── Globals.xaml │ ├── Shared │ │ ├── FocusVisuals.xaml │ │ ├── TemplateParts.xaml │ │ └── Theming.xaml │ └── Themes.xaml ├── Themes │ └── Generic.xaml ├── Theming │ ├── ControlProperties.cs │ ├── PopupProperties.cs │ ├── RippleProperties.cs │ ├── SelectionProperties.cs │ ├── ShadowProperties.cs │ ├── TabItemProperties.cs │ ├── TextBoxHelper.cs │ ├── TextBoxProperties.cs │ ├── TreeViewHelper.cs │ ├── VisualStateProperties.cs │ ├── VisualStateProperties.tt │ └── WindowTitlebarProperties.cs └── Xaml │ ├── ApplicationTheme.cs │ └── ThemeManagerExtensions.cs ├── ControlGallery ├── App.config ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── Images │ │ ├── Landscape.png │ │ └── ThumbnailAbstract.png │ └── Xshd │ │ └── XML-Dark.xshd ├── Common │ ├── GalleryPageViewModel.cs │ ├── NavigationViewModel.cs │ ├── RegionNames.cs │ └── RegionNavigationExtensions.cs ├── ControlGallery.csproj ├── Controls │ ├── ControlPresenter.cs │ └── XamlFormatterEx.cs ├── Converters │ └── StringToTextDocumentConverter.cs ├── Data │ ├── Categories │ │ ├── KnownCategories.Animations.cs │ │ ├── KnownCategories.Commanding.cs │ │ ├── KnownCategories.Containers.cs │ │ ├── KnownCategories.Indicators.cs │ │ ├── KnownCategories.Input.cs │ │ ├── KnownCategories.Layout.cs │ │ ├── KnownCategories.Navigation.cs │ │ └── KnownCategories.Text.cs │ ├── ControlCategory.cs │ ├── ControlDataSource.cs │ ├── ControlInformation.cs │ ├── FruitItems.cs │ ├── LoremItems.cs │ ├── README.txt │ ├── SampleCommands.cs │ └── SongItems.cs ├── GalleryBootstrapper.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ └── Settings.settings ├── Themes │ ├── AvalonEdit.xaml │ ├── Generic.xaml │ └── XamlDisplay.xaml └── Xaml │ ├── CategoryPage.xaml │ ├── CategoryPage.xaml.cs │ ├── CategoryPageViewModel.cs │ ├── ControlPage.xaml │ ├── ControlPage.xaml.cs │ ├── ControlPageViewModel.cs │ ├── HomePage.xaml │ ├── HomePage.xaml.cs │ ├── HomePageViewModel.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── MainWindowViewModel.cs │ └── SamplePages │ ├── Animations │ ├── BrushAnimation.xaml │ └── BrushAnimation.xaml.cs │ ├── Commanding │ ├── Button.xaml │ └── Button.xaml.cs │ ├── Containers │ ├── Card.xaml │ ├── Card.xaml.cs │ ├── GroupBox.xaml │ └── GroupBox.xaml.cs │ ├── Indicators │ ├── ProgressBar.xaml │ └── ProgressBar.xaml.cs │ ├── Input │ ├── CheckBox.xaml │ ├── CheckBox.xaml.cs │ ├── ComboBox.xaml │ ├── ComboBox.xaml.cs │ ├── ListBox.xaml │ ├── ListBox.xaml.cs │ ├── ListView.xaml │ ├── ListView.xaml.cs │ ├── PasswordBox.xaml │ ├── PasswordBox.xaml.cs │ ├── RadioButton.xaml │ ├── RadioButton.xaml.cs │ ├── Slider.xaml │ ├── Slider.xaml.cs │ ├── TextBox.xaml │ ├── TextBox.xaml.cs │ ├── ToggleSwitch.xaml │ ├── ToggleSwitch.xaml.cs │ ├── TreeView.xaml │ └── TreeView.xaml.cs │ ├── Layout │ ├── Expander.xaml │ ├── Expander.xaml.cs │ ├── Menu.xaml │ ├── Menu.xaml.cs │ ├── RelativeCanvas.xaml │ ├── RelativeCanvas.xaml.cs │ ├── ScrollViewer.xaml │ ├── ScrollViewer.xaml.cs │ ├── SplitView.xaml │ ├── SplitView.xaml.cs │ ├── StatusBar.xaml │ ├── StatusBar.xaml.cs │ ├── ToolBar.xaml │ └── ToolBar.xaml.cs │ ├── Navigation │ ├── NavigationView.xaml │ ├── NavigationView.xaml.cs │ ├── TabControl.xaml │ ├── TabControl.xaml.cs │ ├── Window.xaml │ └── Window.xaml.cs │ └── Text │ ├── Label.xaml │ ├── Label.xaml.cs │ ├── TextBlock.xaml │ ├── TextBlock.xaml.cs │ ├── ToolTip.xaml │ └── ToolTip.xaml.cs ├── Directory.Build.props ├── Directory.Build.targets └── global.json /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a Bug report 4 | 5 | --- 6 | 7 | #### Describe the bug 8 | 9 | 10 | 11 | #### Screenshots (optional) 12 | 13 | 14 | #### Additional context (optional) 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation issue 3 | about: An issue which deals with the documentation. 4 | 5 | --- 6 | 7 | #### What is the problem? 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | #### What should the new feature look like? 8 | 9 | 10 | #### Why do you need this feature/Why is it important to the project? (optional if described above) 11 | 12 | 13 | #### Additional information/comments (optional) 14 | -------------------------------------------------------------------------------- /.github/Images/ControlGalleryExample1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuelroemer/Celestial.UIToolkit/933a0e7704bfe9ec5de5a35336489165393914c5/.github/Images/ControlGalleryExample1.png -------------------------------------------------------------------------------- /.github/Images/ControlGalleryExample2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuelroemer/Celestial.UIToolkit/933a0e7704bfe9ec5de5a35336489165393914c5/.github/Images/ControlGalleryExample2.png -------------------------------------------------------------------------------- /.github/Images/ControlGalleryExample3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuelroemer/Celestial.UIToolkit/933a0e7704bfe9ec5de5a35336489165393914c5/.github/Images/ControlGalleryExample3.png -------------------------------------------------------------------------------- /.github/Images/DllArchitecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuelroemer/Celestial.UIToolkit/933a0e7704bfe9ec5de5a35336489165393914c5/.github/Images/DllArchitecture.png -------------------------------------------------------------------------------- /.github/Images/MainExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuelroemer/Celestial.UIToolkit/933a0e7704bfe9ec5de5a35336489165393914c5/.github/Images/MainExample.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Manuel Römer 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 | -------------------------------------------------------------------------------- /build/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - master 3 | 4 | name: $(releaseVersion)+ci-$(Build.BuildId) 5 | 6 | pool: 7 | vmImage: 'VS2017-Win2016' 8 | 9 | variables: 10 | solution: '**/*.sln' 11 | buildPlatform: 'Any CPU' 12 | buildConfiguration: 'Release' 13 | releaseVersion: '0.2.0' # This needs to be incremented manually and should follow SemVer 1.0. 14 | 15 | steps: 16 | # Install NuGet packages and do a nuget restore. 17 | - task: NuGetToolInstaller@0 18 | displayName: 'Use latest NuGet version' 19 | 20 | - task: NuGetCommand@2 21 | displayName: 'NuGet Restore' 22 | inputs: 23 | restoreSolution: '$(solution)' 24 | noCache: true 25 | 26 | # Build and test. 27 | - task: MSBuild@1 28 | displayName: 'Build solutions' 29 | inputs: 30 | solution: '$(solution)' 31 | platform: '$(buildPlatform)' 32 | configuration: '$(buildConfiguration)' 33 | 34 | - task: VSTest@2 35 | displayName: 'Run tests' 36 | inputs: 37 | platform: '$(buildPlatform)' 38 | configuration: '$(buildConfiguration)' 39 | 40 | # Generate documentation files. 41 | - task: PowerShell@2 42 | displayName: 'Generate Documentation' 43 | inputs: 44 | filePath: './build/generate-docs.ps1' 45 | 46 | # Publish Dlls, ControlGallery, NuGet Packages and Documentation files. 47 | - task: PublishBuildArtifacts@1 48 | displayName: 'Publish Dll Artifacts' 49 | inputs: 50 | PathtoPublish: '$(Build.ArtifactStagingDirectory)/Binaries' 51 | ArtifactName: 'Binaries' 52 | condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) 53 | 54 | - task: PublishBuildArtifacts@1 55 | displayName: 'Publish ControlGallery Artifacts' 56 | inputs: 57 | PathtoPublish: '$(Build.ArtifactStagingDirectory)/ControlGallery' 58 | ArtifactName: 'ControlGallery' 59 | condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) 60 | 61 | - task: PublishBuildArtifacts@1 62 | displayName: 'Publish NuGet Package Artifacts' 63 | inputs: 64 | PathtoPublish: '$(Build.ArtifactStagingDirectory)/NuGet' 65 | ArtifactName: 'NuGet-Packages' 66 | condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) 67 | 68 | - task: PublishBuildArtifacts@1 69 | displayName: 'Publish Documentation Artifacts' 70 | inputs: 71 | PathtoPublish: '$(Build.ArtifactStagingDirectory)/Documentation/_site' 72 | ArtifactName: 'Documentation' 73 | condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) 74 | -------------------------------------------------------------------------------- /build/generate-docs.ps1: -------------------------------------------------------------------------------- 1 | # Documentation is auto-generated by DocFx. 2 | # We need to install the tools and then auto-generate the documentation from the ~/doc folder. 3 | # The generated files are then published as a Build Artifact and processed by a Release Pipeline. 4 | 5 | if ([string]::IsNullOrEmpty(($env:BUILD_ARTIFACTSTAGINGDIRECTORY))) { 6 | Write-Host "BUILD_ARTIFACTSTAGINGDIRECTORY was not set. Not generating documentation." 7 | return 8 | } 9 | 10 | $targetDir = [System.IO.Path]::Combine( 11 | $env:BUILD_ARTIFACTSTAGINGDIRECTORY, 12 | "Documentation" 13 | ) 14 | 15 | # DocFx uses this environment variable for fetching the sources. 16 | # We want to always generate doc from the master branch. 17 | # -> Temporarily set this env variable to master. 18 | $prevBuildSourceBranchName = $env:BUILD_SOURCEBRANCHNAME 19 | $env:BUILD_SOURCEBRANCHNAME = "master" 20 | 21 | Write-Host "Installing DocFx..." 22 | choco install docfx -y 23 | Write-Host "DocFx installed." 24 | 25 | Write-Host "Generating documentation..." 26 | Set-Location doc 27 | docfx metadata 28 | docfx build -o "$targetDir" 29 | Write-Host "Generated documentation." 30 | 31 | # Reset env var (see above). Perhaps unnecessary? 32 | $env:BUILD_SOURCEBRANCHNAME = $prevBuildSourceBranchName 33 | -------------------------------------------------------------------------------- /doc/articles/getting-started/installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | The libraries can be installed via NuGet. 3 | -------------------------------------------------------------------------------- /doc/articles/getting-started/style-naming-format.md: -------------------------------------------------------------------------------- 1 | 2 | ## Style Naming Format 3 | The styles in the toolkit follow the following naming convention: 4 | 5 | ``` 6 | StyleName := [SizeModifier][Specialization] 7 | 8 | where: 9 | 10 | SizeModifier := "Large" | "Compact" 11 | ColorTheme := "Standard" | "Accent1" | "Accent2" 12 | Specialization := "[Any possible string. Up to the Style Author.]" 13 | ControlName := "[The .NET type name of the Control.]" 14 | ``` 15 | 16 | There are some exceptions to the `ControlName` rule. 17 | Sometimes, a single style is used for multiple Controls. 18 | This can happen when the controls have a shared base class from which they inherit, 19 | e.g. `Button` and `ToggleButton`. 20 | 21 | In this case, the styles have a generalized control name. 22 | For buttons, the styles are called `...Button`. 23 | 24 | ### Examples 25 | 26 | **The simplest Style names:** 27 | 28 | ``` 29 | StandardTextBox 30 | Accent1ComboBox 31 | Accent2Button 32 | 33 | == 34 | ``` 35 | 36 | 37 | **Specialized Style names:** 38 | 39 | ``` 40 | StandardFlatButton 41 | Accent1CircleButton 42 | Accent1OutlinedComboBox 43 | Accent2OutlinedTextBox 44 | 45 | == [Specialization] 46 | ``` 47 | 48 | 49 | **Size variations:** 50 | 51 | ``` 52 | LargeStandardListBox 53 | CompactAccent1ListView 54 | LargeAccent2ListView 55 | 56 | == [SizeModifier] 57 | ``` 58 | 59 | 60 | **All together:** 61 | *(Note: This style doesn't exist - it is just an example.)* 62 | 63 | ``` 64 | CompactAccent1SpecializedButton 65 | 66 | == [SizeModifier][Specialization] 67 | ``` 68 | -------------------------------------------------------------------------------- /doc/articles/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | Welcome to the Celestial.UIToolkit project! 3 | -------------------------------------------------------------------------------- /doc/articles/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Introduction 2 | href: introduction.md 3 | - name: Getting Started 4 | items: 5 | - name: Installation 6 | href: getting-started/installation.md -------------------------------------------------------------------------------- /doc/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": [ 3 | { 4 | "src": [ 5 | { 6 | "files": [ 7 | "**.csproj" 8 | ], 9 | "exclude": [ 10 | "**/bin/**", 11 | "**/obj/**", 12 | "**/ControlGallery/**", 13 | "**/*Test*/**" 14 | ], 15 | "src": "../src" 16 | } 17 | ], 18 | "dest": "api", 19 | "filter": "filterConfig.yml", 20 | "properties": { 21 | "TargetFramework": "net45" 22 | } 23 | } 24 | ], 25 | "build": { 26 | "content": [ 27 | { 28 | "files": [ 29 | "api/**.yml", 30 | "api/index.md" 31 | ] 32 | }, 33 | { 34 | "files": [ 35 | "**.md", 36 | "toc.yml", 37 | "articles/**.md", 38 | "articles/**/toc.yml" 39 | ] 40 | } 41 | ], 42 | "resource": [ 43 | { 44 | "files": [ 45 | "images/**" 46 | ] 47 | } 48 | ], 49 | "overwrite": [ 50 | { 51 | "files": [ 52 | "src/**.md" 53 | ], 54 | "exclude": [ 55 | "obj/**", 56 | "_site/**" 57 | ] 58 | } 59 | ], 60 | "dest": "_site", 61 | "globalMetadataFiles": [], 62 | "fileMetadataFiles": [], 63 | "template": [ 64 | "default" 65 | ], 66 | "xrefService": [ 67 | "https://xref.docs.microsoft.com/query?uid={uid}" 68 | ], 69 | "postProcessors": [], 70 | "markdownEngineName": "markdig", 71 | "noLangKeyword": false, 72 | "keepFileLink": false, 73 | "cleanupCacheHistory": false, 74 | "disableGitFeatures": false, 75 | "globalMetadata": { 76 | "_appTitle": "Celestial.UIToolkit", 77 | "_appFooter": "Copyright © 2018 Celestial.UIToolkit - Impressum", 78 | "_gitContribute": { 79 | "repo": "https://github.com/manuelroemer/Celestial.UIToolkit", 80 | "branch": "master" 81 | }, 82 | "_gitUrlPattern": "github" 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Celestial.UIToolkit.Core.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net46 6 | 7 | Properties 8 | 9 | False 10 | 11 | true 12 | true 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | MSBuild:Compile 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/BooleanToVisibilityConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows; 5 | using Xunit; 6 | 7 | namespace Celestial.UIToolkit.Tests.Converters 8 | { 9 | 10 | public class BooleanToVisibilityConverterTests 11 | { 12 | 13 | [Fact] 14 | public void ConvertsBoolToVisibility() 15 | { 16 | var converter = new BooleanToVisibilityConverter(); 17 | Assert.Equal( 18 | converter.TrueVisibility, 19 | converter.Convert(true, null, CultureInfo.CurrentCulture)); 20 | Assert.Equal( 21 | converter.FalseVisibility, 22 | converter.Convert(false, null, CultureInfo.CurrentCulture)); 23 | 24 | Assert.True(converter.ConvertBack(converter.TrueVisibility, null, CultureInfo.CurrentCulture)); 25 | Assert.False(converter.ConvertBack(converter.FalseVisibility, null, CultureInfo.CurrentCulture)); 26 | } 27 | 28 | [Fact] 29 | public void ThrowsForSameVisibilityProperties() 30 | { 31 | var converter = new BooleanToVisibilityConverter(Visibility.Visible, Visibility.Visible); 32 | Assert.Throws(() => 33 | converter.ConvertBack(Visibility.Visible, null, CultureInfo.CurrentCulture)); 34 | } 35 | 36 | [Fact] 37 | public void ThrowsForUnknownVisibility() 38 | { 39 | var converter = new BooleanToVisibilityConverter(Visibility.Visible, Visibility.Collapsed); 40 | Assert.Throws(() => 41 | converter.ConvertBack(Visibility.Hidden, null, CultureInfo.CurrentCulture)); 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/ColorToSolidColorBrushConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System.Globalization; 3 | using System.Windows.Media; 4 | using Xunit; 5 | 6 | namespace Celestial.UIToolkit.Tests.Converters 7 | { 8 | 9 | public class ColorToSolidColorBrushConverterTests 10 | { 11 | 12 | [Fact] 13 | public void ConvertsColorToBrush() 14 | { 15 | var converter = new ColorToSolidColorBrushConverter(); 16 | SolidColorBrush result = converter.Convert(Colors.Red, null, CultureInfo.CurrentCulture); 17 | 18 | Assert.Equal(Colors.Red, result.Color); 19 | } 20 | 21 | [Fact] 22 | public void ConvertsBrushBackToColor() 23 | { 24 | var converter = new ColorToSolidColorBrushConverter(); 25 | Color result = converter.ConvertBack(Brushes.Red, null, CultureInfo.CurrentCulture); 26 | 27 | Assert.Equal(Colors.Red, result); 28 | } 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/DoubleToCornerRadiusConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System.Windows; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Converters 6 | { 7 | 8 | public class DoubleToCornerRadiusConverterTests 9 | { 10 | 11 | [Fact] 12 | public void ConvertsDoubleToUniformCornerRadius() 13 | { 14 | var converter = new DoubleToCornerRadiusConverter(); 15 | CornerRadius result = converter.Convert(5d, null, null); 16 | 17 | Assert.True(result.BottomLeft == result.BottomRight && 18 | result.BottomLeft == result.TopLeft && 19 | result.BottomLeft == result.TopRight && 20 | result.BottomLeft == 5); 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/GetTypeConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Converters 6 | { 7 | 8 | public class GetTypeConverterTests 9 | { 10 | 11 | [Fact] 12 | public void ReturnsCorrectType() 13 | { 14 | var converter = new GetTypeConverter(); 15 | object value = "A String."; 16 | Type result = converter.Convert(value, null, null); 17 | 18 | Assert.Equal(value.GetType(), result); 19 | } 20 | 21 | [Fact] 22 | public void ThrowsArgumentNullExceptionForNullValue() 23 | { 24 | var converter = new GetTypeConverter(); 25 | Assert.Throws(() => converter.Convert(null, null, null)); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/GroupConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Converters 6 | { 7 | 8 | public class GroupConverterTests 9 | { 10 | 11 | [Fact] 12 | public void UsesMultipleConverters() 13 | { 14 | var converter = new GroupConverter(); 15 | converter.Add(new MathOperationConverter(MathOperator.Add)); 16 | converter.Add(new MathOperationConverter(MathOperator.Subtract)); 17 | 18 | Assert.Equal(5, converter.Convert(5, typeof(int), 1, null)); 19 | } 20 | 21 | [Fact] 22 | public void CannotConvertBack() 23 | { 24 | var converter = new GroupConverter(); 25 | Assert.Throws(() => converter.ConvertBack(null, null, null, null)); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/InvertBooleanConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using Xunit; 3 | 4 | namespace Celestial.UIToolkit.Tests.Converters 5 | { 6 | 7 | public class InvertBooleanConverterTests 8 | { 9 | 10 | [Fact] 11 | public void InvertsBoolean() 12 | { 13 | var converter = new InvertBooleanConverter(); 14 | 15 | Assert.True(converter.Convert(false, null, null)); 16 | Assert.False(converter.Convert(true, null, null)); 17 | } 18 | 19 | [Fact] 20 | public void InvertsBooleanBack() 21 | { 22 | var converter = new InvertBooleanConverter(); 23 | 24 | Assert.True(converter.ConvertBack(false, null, null)); 25 | Assert.False(converter.ConvertBack(true, null, null)); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/InvertingConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | using Xunit; 6 | 7 | namespace Celestial.UIToolkit.Tests.Converters 8 | { 9 | 10 | public class InvertingConverterTests 11 | { 12 | 13 | [Fact] 14 | public void InvertsOtherConverter() 15 | { 16 | IValueConverter normalConverter = new IntToStringConverter(); 17 | var invertingConverter = new InvertingConverter(normalConverter); 18 | 19 | const int convertValue = 123; 20 | const string convertBackValue = "123"; 21 | 22 | Assert.Equal( 23 | normalConverter.Convert(convertValue, typeof(string), null, null), 24 | invertingConverter.ConvertBack(convertValue, typeof(string), null, null)); 25 | Assert.Equal( 26 | normalConverter.ConvertBack(convertBackValue, typeof(string), null, null), 27 | invertingConverter.Convert(convertBackValue, typeof(string), null, null)); 28 | } 29 | 30 | [Fact] 31 | public void ThrowsWithoutUnderlyingConverter() 32 | { 33 | var invertingConverter = new InvertingConverter(); 34 | 35 | Assert.Throws(() => invertingConverter.Convert( 36 | new object(), typeof(object), null, CultureInfo.CurrentCulture)); 37 | 38 | Assert.Throws(() => invertingConverter.ConvertBack( 39 | new object(), typeof(object), null, CultureInfo.CurrentCulture)); 40 | } 41 | 42 | private class IntToStringConverter : IValueConverter 43 | { 44 | 45 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 46 | { 47 | return value.ToString(); 48 | } 49 | 50 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 51 | { 52 | return int.Parse((String)value); 53 | } 54 | 55 | } 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/NullToVisibilityConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System.Globalization; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Converters 6 | { 7 | 8 | public class NullToVisibilityConverterTests 9 | { 10 | 11 | [Fact] 12 | public void ConvertsNullValues() 13 | { 14 | var converter = new NullToVisibilityConverter(); 15 | Assert.Equal( 16 | converter.NullVisibility, 17 | converter.Convert(null, null, CultureInfo.CurrentCulture)); 18 | Assert.Equal( 19 | converter.NotNullVisibility, 20 | converter.Convert(new object(), null, CultureInfo.CurrentCulture)); 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/StringToVisibilityConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System.Globalization; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Converters 6 | { 7 | 8 | public class StringToVisibilityConverterTests 9 | { 10 | 11 | [Fact] 12 | public void ConvertsNullValues() 13 | { 14 | var converter = new StringToVisibilityConverter(); 15 | Assert.Equal( 16 | converter.NullVisibility, 17 | converter.Convert(null, null, CultureInfo.CurrentCulture)); 18 | Assert.Equal( 19 | converter.NotNullVisibility, 20 | converter.Convert(new object(), null, CultureInfo.CurrentCulture)); 21 | } 22 | 23 | [Fact] 24 | public void ConvertsStringValues() 25 | { 26 | var converter = new StringToVisibilityConverter(); 27 | converter.IncludeWhiteSpace = false; 28 | 29 | Assert.Equal( 30 | converter.NullVisibility, 31 | converter.Convert("", null, CultureInfo.CurrentCulture)); 32 | Assert.Equal( 33 | converter.NotNullVisibility, 34 | converter.Convert("Not empty", null, CultureInfo.CurrentCulture)); 35 | 36 | converter.IncludeWhiteSpace = true; 37 | Assert.Equal( 38 | converter.NullVisibility, 39 | converter.Convert(" \t", null, CultureInfo.CurrentCulture)); 40 | } 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/ThicknessSidePickerConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System.Windows; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Converters 6 | { 7 | 8 | public class ThicknessSidePickerConverterTests 9 | { 10 | 11 | [Fact] 12 | public void ChangesAllSides() 13 | { 14 | var converter = new ThicknessSidePickerConverter() 15 | { 16 | Top = 5, 17 | Left = 5, 18 | Right = 5, 19 | Bottom = 5 20 | }; 21 | 22 | var thickness = new Thickness(1, 2, 3, 4); 23 | var expectedThickness = new Thickness(5); 24 | 25 | Assert.Equal( 26 | expectedThickness, 27 | converter.Convert(thickness, null, null)); 28 | } 29 | 30 | [Fact] 31 | public void KeepsAllSides() 32 | { 33 | var converter = new ThicknessSidePickerConverter(); 34 | var thickness = new Thickness(1, 2, 3, 4); 35 | Assert.Equal( 36 | thickness, 37 | converter.Convert(thickness, null, null)); 38 | } 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Converters/ValueConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using System; 3 | using System.Globalization; 4 | using Xunit; 5 | 6 | namespace Celestial.UIToolkit.Tests.Converters 7 | { 8 | 9 | public class ValueConverterTests 10 | { 11 | 12 | [Fact] 13 | public void ThrowsForUnimplementedMethods() 14 | { 15 | var converter = new UnimplementedValueConverter(); 16 | Assert.Throws(() => 17 | converter.Convert(0, typeof(int), null, CultureInfo.CurrentCulture)); 18 | Assert.Throws(() => 19 | converter.ConvertBack(0, typeof(int), null, CultureInfo.CurrentCulture)); 20 | } 21 | 22 | [Fact] 23 | public void ThrowsForWrongInputs() 24 | { 25 | var converter = new ImplementedValueConverter(); 26 | 27 | // Wrong Input type. 28 | Assert.Throws(() => 29 | converter.Convert("String", typeof(int), null, CultureInfo.CurrentCulture)); 30 | Assert.Throws(() => 31 | converter.ConvertBack("String", typeof(int), null, CultureInfo.CurrentCulture)); 32 | 33 | // Wrong target type. 34 | Assert.Throws(() => 35 | converter.Convert(0, typeof(string), null, CultureInfo.CurrentCulture)); 36 | Assert.Throws(() => 37 | converter.ConvertBack(0, typeof(string), null, CultureInfo.CurrentCulture)); 38 | } 39 | 40 | private class UnimplementedValueConverter : ValueConverter { } 41 | 42 | private class ImplementedValueConverter : UnimplementedValueConverter 43 | { 44 | public override int Convert(int value, object parameter, CultureInfo culture) => value; 45 | public override int ConvertBack(int value, object parameter, CultureInfo culture) => value; 46 | } 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Extensions/ArrayExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Extensions; 2 | using System; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using Xunit; 6 | 7 | namespace Celestial.UIToolkit.Tests.Extensions 8 | { 9 | 10 | public class ArrayExtensionsTests 11 | { 12 | 13 | [Theory] 14 | [ClassData(typeof(SegmentTestDataSource))] 15 | public void GetGroupSegmentsTest(int[] array, IEnumerable> expectedSegments) 16 | { 17 | Func IsEven = (num) => num % 2 == 0; 18 | var groupSegments = array.GetGroupSegments(IsEven); 19 | Assert.Equal(expectedSegments, groupSegments); 20 | } 21 | 22 | private class SegmentTestDataSource : IEnumerable 23 | { 24 | public IEnumerator GetEnumerator() 25 | { 26 | yield return new object[] 27 | { 28 | new int[0], 29 | new ArraySegment[0] 30 | }; 31 | 32 | yield return new object[] 33 | { 34 | new int[] { 1, 1, 1, 1, 1 }, 35 | new ArraySegment[0] 36 | }; 37 | 38 | int[] evenOnlyArray = new int[] { 2, 2, 2, 2, 2 }; 39 | yield return new object[] 40 | { 41 | evenOnlyArray, 42 | new ArraySegment[] 43 | { 44 | new ArraySegment(evenOnlyArray, 0, evenOnlyArray.Length) 45 | } 46 | }; 47 | 48 | int[] startEndSegmentsArray = new int[] { 2, 2, 2, 1, 2, 2, 2 }; 49 | yield return new object[] 50 | { 51 | startEndSegmentsArray, 52 | new ArraySegment[] 53 | { 54 | new ArraySegment(startEndSegmentsArray, 0, 3), 55 | new ArraySegment(startEndSegmentsArray, 4, 3), 56 | } 57 | }; 58 | 59 | int[] middleSegmentArray = new int[] { 1, 2, 1 }; 60 | yield return new object[] 61 | { 62 | middleSegmentArray, 63 | new ArraySegment[] 64 | { 65 | new ArraySegment(middleSegmentArray, 1, 1) 66 | } 67 | }; 68 | } 69 | 70 | IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); 71 | } 72 | 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Extensions/ArraySegmentExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Extensions; 2 | using System; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Extensions 6 | { 7 | 8 | public class ArraySegmentExtensionsTests 9 | { 10 | 11 | [Fact] 12 | public void IncludesElementAtReturnsCorrectValue() 13 | { 14 | var array = new int[] { 0, 1, 2, 3, 4 }; 15 | var segment = new ArraySegment(array, 1, 4); 16 | 17 | Assert.False(segment.IncludesElementAt(0)); 18 | for (int i = segment.Offset; i < segment.Offset + segment.Count; i++) 19 | { 20 | Assert.True(segment.IncludesElementAt(i)); 21 | } 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Media/Animations/AnimationBaseTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Tests.Media.Animations.Mocks; 2 | using System; 3 | using System.Windows.Media.Animation; 4 | using Xunit; 5 | 6 | namespace Celestial.UIToolkit.Tests.Media.Animations 7 | { 8 | 9 | public class AnimationBaseTests 10 | { 11 | 12 | [Theory] 13 | [InlineData(123, 0d)] 14 | [InlineData(0d, 123)] 15 | [InlineData("Invalid", 1d)] 16 | [InlineData("Invalid", "Also invalid")] 17 | public void ThrowsIfInputValuesHaveWrongType(object from, object to) 18 | { 19 | var animation = new SimpleDoubleAnimation(); 20 | var clock = new ControllableAnimationClock(); 21 | 22 | Assert.Throws(() => 23 | animation.GetCurrentValue(from, to, clock)); 24 | } 25 | 26 | [Fact] 27 | public void ThrowsIfAnimationClockIsNull() 28 | { 29 | var animation = new SimpleDoubleAnimation(); 30 | AnimationClock clock = null; 31 | 32 | Assert.Throws(() => 33 | animation.GetCurrentValue(0d, 0d, clock)); 34 | } 35 | 36 | [Fact] 37 | public void HasCorrectTargetType() 38 | { 39 | var animation = new SimpleDoubleAnimation(); 40 | Assert.Equal(typeof(double), animation.TargetPropertyType); 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Media/Animations/AnimationUsingKeyFramesBaseTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using DoubleAnimationUsingKeyFrames = Celestial.UIToolkit.Tests.Media.Animations.Mocks.DoubleAnimationUsingKeyFrames; 7 | using DiscreteDoubleKeyFrame = Celestial.UIToolkit.Tests.Media.Animations.Mocks.DiscreteDoubleKeyFrame; 8 | using LinearDoubleKeyFrame = Celestial.UIToolkit.Tests.Media.Animations.Mocks.LinearDoubleKeyFrame; 9 | using EasingDoubleKeyFrame = Celestial.UIToolkit.Tests.Media.Animations.Mocks.EasingDoubleKeyFrame; 10 | using SplineDoubleKeyFrame = Celestial.UIToolkit.Tests.Media.Animations.Mocks.SplineDoubleKeyFrame; 11 | using DoubleKeyFrameCollection = Celestial.UIToolkit.Tests.Media.Animations.Mocks.DoubleKeyFrameCollection; 12 | using Celestial.UIToolkit.Media.Animations; 13 | using Celestial.UIToolkit.Tests.Media.Animations.Mocks; 14 | using Xunit; 15 | using System.Windows; 16 | using System.Windows.Media.Animation; 17 | 18 | namespace Celestial.UIToolkit.Tests.Media.Animations 19 | { 20 | 21 | public class AnimationUsingKeyFramesBaseTests 22 | { 23 | 24 | // TODO 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Media/Animations/EasingFromToByAnimationTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Tests.Media.Animations.Mocks; 2 | using System.Windows.Media.Animation; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Media.Animations 6 | { 7 | 8 | public class EasingFromToByAnimationTests 9 | { 10 | 11 | [Fact] 12 | public void AppliesEasingFunction() 13 | { 14 | const double defaultOrigin = 0; 15 | const double defaultDestination = 100; 16 | var defaultAnimation = new FromToByDoubleAnimation(); 17 | var easingAnimation = new FromToByDoubleAnimation(); 18 | var clock = new ControllableAnimationClock(); 19 | var easingFunction = new QuadraticEase(); 20 | 21 | easingAnimation.EasingFunction = easingFunction; 22 | 23 | for (double progress = 0d; progress <= 1d; progress += 0.01) 24 | { 25 | // Manually apply the easing function. 26 | double easedProgress = easingFunction.Ease(progress); 27 | clock.CurrentProgress = easedProgress; 28 | double expectedResult = defaultAnimation.GetCurrentValue(defaultOrigin, defaultDestination, clock); 29 | 30 | // Then test if the animation does it on its own. 31 | clock.CurrentProgress = progress; 32 | double easedResult = easingAnimation.GetCurrentValue(defaultOrigin, defaultDestination, clock); 33 | 34 | Assert.Equal(expectedResult, easedResult); 35 | } 36 | } 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Media/Animations/Mocks/FromToByDoubleAnimation.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Media.Animations; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit.Tests.Media.Animations.Mocks 5 | { 6 | 7 | /// 8 | /// A From/To/By animation which animates doubles. 9 | /// 10 | public class FromToByDoubleAnimation : EasingFromToByAnimationBase 11 | { 12 | 13 | public FromToByDoubleAnimation( 14 | double? from = null, 15 | double? to = null, 16 | double? by = null) 17 | { 18 | if (from != null) 19 | From = from.Value; 20 | if (to != null) 21 | To = to.Value; 22 | if (by != null) 23 | By = by.Value; 24 | } 25 | 26 | protected override Freezable CreateInstanceCore() 27 | { 28 | return new FromToByDoubleAnimation(); 29 | } 30 | 31 | protected override double AddValues(double a, double b) 32 | { 33 | return a + b; 34 | } 35 | 36 | protected override double SubtractValues(double a, double b) 37 | { 38 | return a - b; 39 | } 40 | 41 | protected override double ScaleValue(double value, double factor) 42 | { 43 | return value * factor; 44 | } 45 | 46 | protected override double InterpolateValueCore(double from, double to, double progress) 47 | { 48 | return from + (to - from) * progress; 49 | } 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Media/Animations/Mocks/SimpleDoubleAnimation.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Media.Animations; 2 | using System.Windows; 3 | using System.Windows.Media.Animation; 4 | 5 | namespace Celestial.UIToolkit.Tests.Media.Animations.Mocks 6 | { 7 | 8 | /// 9 | /// A very simple double animation which directly inherits from 10 | /// and animates the values passed into . 11 | /// 12 | public class SimpleDoubleAnimation : AnimationBase 13 | { 14 | 15 | protected override Freezable CreateInstanceCore() => new SimpleDoubleAnimation(); 16 | 17 | protected override double GetCurrentValueCore( 18 | double from, 19 | double to, 20 | IAnimationClock animationClock) 21 | { 22 | double progress = animationClock.CurrentProgress.Value; 23 | 24 | // Perform a very simple animation. 25 | // Return a scaled value between from and to, depending on the current progress. 26 | if (progress == 0) 27 | return from; 28 | else if (progress == 1) 29 | return to; 30 | else 31 | return from + (to - from) * progress; 32 | } 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Resources/SampleDictionary.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 14 | 15 | 18 | 19 | 27 | 28 | 1.0,2.0 29 | 1,2,3,4 30 | 1,2,3,4 31 | 32 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Resources/SampleDictionaryKeys.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit.Tests.Resources 5 | { 6 | 7 | /// 8 | /// Provides keys for the resources in the "SampleDictionary.xaml" 9 | /// resource dictionary. 10 | /// 11 | public static class SampleDictionaryKeys 12 | { 13 | 14 | public static readonly Uri DictionaryUri; 15 | 16 | public static readonly string CheckBoxStyleKey = "CheckBoxStyle"; 17 | public static readonly string PointResourceKey = "PointResource"; 18 | public static readonly string ThicknessResourceKey = "ThicknessResource"; 19 | public static readonly string CornerRadiusResourceKey = "CornerRadiusResource"; 20 | 21 | static SampleDictionaryKeys() 22 | { 23 | InitializePackUriScheme(); 24 | DictionaryUri = new Uri( 25 | "pack://application:,,,/Celestial.UIToolkit.Core.Tests;component/Resources/SampleDictionary.xaml", 26 | UriKind.RelativeOrAbsolute); 27 | } 28 | 29 | private static void InitializePackUriScheme() 30 | { 31 | // Creating a new Application instance registers the required pack:// scheme. 32 | // Without this, creating such an URI will throw an UriFormatException. 33 | new Application(); 34 | } 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Xaml/BindingExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Xaml; 2 | using System.Windows.Data; 3 | using Xunit; 4 | 5 | namespace Celestial.UIToolkit.Tests.Xaml 6 | { 7 | 8 | public class BindingExtensionsTests 9 | { 10 | 11 | [Fact] 12 | public void SelfBindingExtensionHasCorrectRelativeSource() 13 | { 14 | var binding = new SelfBindingExtension(); 15 | Assert.Equal(RelativeSource.Self, binding.RelativeSource); 16 | } 17 | 18 | [Fact] 19 | public void TemplatedParentBindingExtensionHasCorrectRelativeSource() 20 | { 21 | var binding = new TemplatedParentBindingExtension(); 22 | Assert.Equal(RelativeSource.TemplatedParent, binding.RelativeSource); 23 | } 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Xaml/DependencyProperties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit.Tests.Xaml 5 | { 6 | 7 | /// 8 | /// Provides static dependency properties of various types to be used for testing. 9 | /// 10 | public static class DependencyProperties 11 | { 12 | 13 | public static readonly DependencyProperty DoubleProperty = 14 | DependencyProperty.Register( 15 | "DoubleProperty", 16 | typeof(Double), 17 | typeof(DependencyProperties)); 18 | 19 | public static readonly DependencyProperty ThicknessProperty = 20 | DependencyProperty.Register( 21 | "ThicknessProperty", 22 | typeof(Thickness), 23 | typeof(DependencyProperties)); 24 | 25 | public static readonly DependencyProperty PointProperty = 26 | DependencyProperty.Register( 27 | "PointProperty", 28 | typeof(Point), 29 | typeof(DependencyProperties)); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core.Tests/Xaml/MockedServiceProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Windows.Markup; 4 | 5 | namespace Celestial.UIToolkit.Tests.Xaml 6 | { 7 | 8 | /// 9 | /// A mocked service provider for testing custom markup extensions. 10 | /// 11 | public class MockedServiceProvider : IServiceProvider, IProvideValueTarget 12 | { 13 | 14 | /// 15 | /// Gets a default instance without any property set. 16 | /// 17 | public static MockedServiceProvider Default { get; } = new MockedServiceProvider(); 18 | 19 | public object TargetObject { get; set; } 20 | 21 | public object TargetProperty { get; set; } 22 | 23 | public object GetService(Type serviceType) => this; 24 | 25 | /// 26 | /// Creates a new whose 27 | /// is set to a of the specified type . 28 | /// 29 | public static MockedServiceProvider CreateForTargetPropertyType() 30 | { 31 | return new MockedServiceProvider() 32 | { 33 | TargetProperty = PropertyInfoProvider.GetPropertyInfo() 34 | }; 35 | } 36 | 37 | /// 38 | /// Creates objects of a specified type. 39 | /// 40 | private sealed class PropertyInfoProvider 41 | { 42 | public T Property { get; set; } 43 | 44 | private PropertyInfoProvider() { } 45 | 46 | public static PropertyInfo GetPropertyInfo() 47 | { 48 | return new PropertyInfoProvider().GetType().GetProperty(nameof(Property)); 49 | } 50 | 51 | } 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Celestial.UIToolkit.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net45 6 | 7 | Celestial.UIToolkit 8 | Properties 9 | 10 | true 11 | true 12 | 13 | 14 | The base assembly of Celestial UIToolkit which provides non-specific members that can be useful in any WPF application. 15 | Have a look at the GitHub repository for details on how to use it. 16 | wpf;ui;toolkit;animation;markup;extensions;vsm;visual;state;manager;resources 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Common/Singleton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace Celestial.UIToolkit.Common 5 | { 6 | 7 | /// 8 | /// An abstract base class for a singleton object. 9 | /// When deriving from this class, specify your class as this class' type parameter 10 | /// and ensure that the deriving class has no publicly visible constructors. 11 | /// 12 | /// 13 | /// The type of class which is deriving from this class. 14 | /// 15 | [DebuggerStepThrough] 16 | public abstract class Singleton 17 | { 18 | 19 | private static Lazy _instanceLazy; 20 | 21 | static Singleton() 22 | { 23 | const bool isThreadSafe = true; 24 | _instanceLazy = new Lazy( 25 | () => (T)Activator.CreateInstance(typeof(T), true), 26 | isThreadSafe); 27 | } 28 | 29 | /// 30 | /// Gets the single instance of the singleton. 31 | /// 32 | public static T Instance => _instanceLazy.Value; 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Converters/DoubleToCornerRadiusConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit.Converters 5 | { 6 | 7 | /// 8 | /// A converter which converts a double value to a 9 | /// instance with uniform values. 10 | /// 11 | public class DoubleToCornerRadiusConverter : ValueConverter 12 | { 13 | 14 | /// 15 | /// Gets a default instance of the class. 16 | /// 17 | public static DoubleToCornerRadiusConverter Default { get; } = new DoubleToCornerRadiusConverter(); 18 | 19 | /// 20 | /// Converts a double to a with uniform values. 21 | /// 22 | /// The value to be converted. 23 | /// Not used. 24 | /// Not used. 25 | /// The corner radius instance. 26 | public override CornerRadius Convert(double value, object parameter, CultureInfo culture) 27 | { 28 | return new CornerRadius(value); 29 | } 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Converters/GetTypeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Celestial.UIToolkit.Converters 5 | { 6 | 7 | /// 8 | /// A value converter which returns the of an input object. 9 | /// 10 | public class GetTypeConverter : ValueConverter 11 | { 12 | 13 | /// 14 | /// Gets a default instance of the . 15 | /// 16 | public static GetTypeConverter Default { get; } = new GetTypeConverter(); 17 | 18 | /// 19 | /// Returns the type of the specified . 20 | /// 21 | /// The object whose type should be returned. 22 | /// Not used. 23 | /// Not used. 24 | /// The type of the . 25 | /// 26 | public override Type Convert(object obj, object parameter, CultureInfo culture) 27 | { 28 | if (obj is null) throw new ArgumentNullException(nameof(obj)); 29 | return obj.GetType(); 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Converters/GroupConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace Celestial.UIToolkit.Converters 7 | { 8 | 9 | /// 10 | /// An implementation of the interface which 11 | /// bundles other instances and uses these 12 | /// in order to convert an object. 13 | /// 14 | public class GroupConverter : Collection, IValueConverter 15 | { 16 | 17 | /// 18 | /// Goes through the list of converters and uses these, in order, 19 | /// to convert the specified . 20 | /// 21 | /// The value produced by the binding source. 22 | /// The type of the binding target property. 23 | /// The converter parameter to use. 24 | /// The culture to use in the converter. 25 | /// A converted value. If the method returns null, the valid null value is used. 26 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 27 | { 28 | foreach (var converter in this) 29 | { 30 | value = converter.Convert(value, targetType, parameter, culture); 31 | } 32 | return value; 33 | } 34 | 35 | /// 36 | /// Not supported. 37 | /// 38 | /// Not supported. 39 | /// Not supported. 40 | /// Not supported. 41 | /// Not supported. 42 | /// Not supported. 43 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 44 | { 45 | throw new NotSupportedException( 46 | $"The {nameof(GroupConverter)} cannot convert values back, since there is no guarantee " + 47 | $"that each value is reversible after normal conversion."); 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Converters/InvertBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Celestial.UIToolkit.Converters 6 | { 7 | 8 | /// 9 | /// A value converter which inverts a given value. 10 | /// 11 | [ValueConversion(typeof(bool), typeof(bool))] 12 | public class InvertBooleanConverter : ValueConverter 13 | { 14 | 15 | /// 16 | /// Gets a default instance of the class. 17 | /// 18 | public static InvertBooleanConverter Default { get; } = new InvertBooleanConverter(); 19 | 20 | /// 21 | /// Inverts and returns the specified . 22 | /// 23 | /// The value to be inverted. 24 | /// Not used. 25 | /// Not used. 26 | /// The inverted value. 27 | public override bool Convert(bool value, object parameter, CultureInfo culture) 28 | { 29 | return !value; 30 | } 31 | 32 | /// 33 | /// Inverts and returns the specified . 34 | /// 35 | /// The value to be inverted. 36 | /// Not used. 37 | /// Not used. 38 | /// The inverted value. 39 | public override bool ConvertBack(bool value, object parameter, CultureInfo culture) 40 | { 41 | return !value; 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/DesignMode.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit 5 | { 6 | 7 | /// 8 | /// Provides static members for determining whether the application is currently in 9 | /// the designer mode. 10 | /// 11 | public static class DesignMode 12 | { 13 | 14 | private static readonly DependencyObject _depObj = new DependencyObject(); 15 | 16 | /// 17 | /// Gets a value whether the design mode is enabled. 18 | /// 19 | public static bool IsEnabled => DesignerProperties.GetIsInDesignMode(_depObj); 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Extensions/ArraySegmentExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Celestial.UIToolkit.Extensions 4 | { 5 | 6 | /// 7 | /// Provides extension methods for the structure. 8 | /// 9 | public static class ArraySegmentExtensions 10 | { 11 | 12 | /// 13 | /// Returns a value indicating whether the segment includes 14 | /// the item at the specified . 15 | /// 16 | /// The type of the array. 17 | /// The segment. 18 | /// The index to be checked. 19 | /// 20 | /// true if the segment includes the item at the specified ; 21 | /// false if not. 22 | /// 23 | public static bool IncludesElementAt(this ArraySegment segment, int index) 24 | { 25 | if (index < 0 || index >= segment.Array.Length) 26 | throw new IndexOutOfRangeException(nameof(index)); 27 | return index >= segment.Offset && 28 | index <= segment.Offset + segment.Count - 1; 29 | } 30 | 31 | /// 32 | /// Returns a value indicating whether the segment includes 33 | /// the underlying array's first item. 34 | /// 35 | /// The type of the array. 36 | /// The segment. 37 | /// 38 | /// true if the segment includes the underlying array's first item; 39 | /// false if not. 40 | /// 41 | public static bool IncludesFirstArrayItem(this ArraySegment segment) 42 | { 43 | return segment.IncludesElementAt(0); 44 | } 45 | 46 | /// 47 | /// Returns a value indicating whether the segment includes 48 | /// the underlying array's last item. 49 | /// 50 | /// The type of the array. 51 | /// The segment. 52 | /// 53 | /// true if the segment includes the underlying array's last item; 54 | /// false if not. 55 | /// 56 | public static bool IncludesLastArrayItem(this ArraySegment segment) 57 | { 58 | return segment.IncludesElementAt(segment.Array.Length - 1); 59 | } 60 | 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Extensions/FrameworkElementExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit.Extensions 5 | { 6 | 7 | /// 8 | /// Provides extension methods for the class. 9 | /// 10 | public static class FrameworkElementExtensions 11 | { 12 | 13 | /// 14 | /// Returns a which represents the element's center. 15 | /// 16 | /// The . 17 | /// 18 | /// A instance, pointing to the element's center. 19 | /// 20 | public static Point GetCenter(this FrameworkElement frameworkElement) 21 | { 22 | if (frameworkElement == null) throw new ArgumentNullException(nameof(frameworkElement)); 23 | return new Point( 24 | frameworkElement.ActualWidth / 2, 25 | frameworkElement.ActualHeight / 2); 26 | } 27 | 28 | /// 29 | /// Returns a value indicating whether the specified point is inside the 30 | /// element's bounds. 31 | /// 32 | /// The . 33 | /// 34 | /// A point which may or may not be inside the bounds of the element. 35 | /// The point is expected to be relative to the element, meaning that (0; 0) 36 | /// points to the element's top-left corner. 37 | /// 38 | /// 39 | /// true if the is inside the element's bounds; 40 | /// false if not. 41 | /// 42 | public static bool IsPointInControlBounds(this FrameworkElement frameworkElement, Point point) 43 | { 44 | if (frameworkElement == null) throw new ArgumentNullException(nameof(frameworkElement)); 45 | return point.X >= 0d && 46 | point.Y >= 0d && 47 | point.X <= frameworkElement.ActualWidth && 48 | point.Y <= frameworkElement.ActualHeight; 49 | } 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/AnimationHelper/ColorAnimationHelper.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Common; 2 | using System.Windows.Media; 3 | 4 | namespace Celestial.UIToolkit.Media.Animations 5 | { 6 | 7 | internal class ColorAnimationHelper : Singleton, IAnimationHelper 8 | { 9 | 10 | private ColorAnimationHelper() { } 11 | 12 | public Color GetZeroValue() 13 | { 14 | return new Color(); 15 | } 16 | 17 | public Color AddValues(Color a, Color b) 18 | { 19 | return a + b; 20 | } 21 | 22 | public Color SubtractValues(Color a, Color b) 23 | { 24 | return a - b; 25 | } 26 | 27 | public Color ScaleValue(Color value, double factor) 28 | { 29 | return value * (float)factor; 30 | } 31 | 32 | public Color InterpolateValue(Color from, Color to, double progress) 33 | { 34 | return from + (to - from) * (float)progress; 35 | } 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/AnimationHelper/DoubleAnimationHelper.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Common; 2 | 3 | namespace Celestial.UIToolkit.Media.Animations 4 | { 5 | 6 | internal sealed class DoubleAnimationHelper : Singleton, IAnimationHelper 7 | { 8 | 9 | private DoubleAnimationHelper() { } 10 | 11 | public double GetZeroValue() => 0d; 12 | 13 | public double AddValues(double a, double b) => a + b; 14 | 15 | public double SubtractValues(double a, double b) => a - b; 16 | 17 | public double ScaleValue(double value, double factor) => value * factor; 18 | 19 | public double InterpolateValue(double from, double to, double progress) 20 | { 21 | return from + (to - from) * progress; 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/AnimationHelper/PointAnimationHelper.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Common; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit.Media.Animations 5 | { 6 | 7 | internal sealed class PointAnimationHelper : Singleton, IAnimationHelper 8 | { 9 | 10 | private PointAnimationHelper() { } 11 | 12 | public Point GetZeroValue() => new Point(0, 0); 13 | 14 | public Point AddValues(Point a, Point b) 15 | { 16 | return new Point( 17 | DoubleAnimationHelper.Instance.AddValues(a.X, b.X), 18 | DoubleAnimationHelper.Instance.AddValues(a.Y, b.Y)); 19 | } 20 | 21 | public Point SubtractValues(Point a, Point b) 22 | { 23 | return new Point( 24 | DoubleAnimationHelper.Instance.SubtractValues(a.X, b.X), 25 | DoubleAnimationHelper.Instance.SubtractValues(a.Y, b.Y)); 26 | } 27 | 28 | public Point ScaleValue(Point value, double factor) 29 | { 30 | return new Point( 31 | DoubleAnimationHelper.Instance.ScaleValue(value.X, factor), 32 | DoubleAnimationHelper.Instance.ScaleValue(value.Y, factor)); 33 | } 34 | 35 | public Point InterpolateValue(Point from, Point to, double progress) 36 | { 37 | return new Point( 38 | DoubleAnimationHelper.Instance.InterpolateValue(from.X, to.X, progress), 39 | DoubleAnimationHelper.Instance.InterpolateValue(from.Y, to.Y, progress)); 40 | } 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/AnimationUsingKeyFramesBase/IInterpolatingKeyFrame.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media.Animation; 2 | 3 | namespace Celestial.UIToolkit.Media.Animations 4 | { 5 | 6 | /// 7 | /// An extension of the interface, 8 | /// which defines a key frame which has the ability to interpolate 9 | /// its value, depending on a progress factor. 10 | /// 11 | /// The type of the key frame's property. 12 | public interface IInterpolatingKeyFrame : IKeyFrame 13 | { 14 | 15 | /// 16 | /// Returns the interpolated value of this key frame at the provided progress increment. 17 | /// 18 | /// The value to animate from. 19 | /// 20 | /// A value between 0.0 and 1.0, inclusive, that specifies the percentage of time 21 | /// that has elapsed for this key frame. 22 | /// 23 | /// The output value of this key frame given the specified base value and progress. 24 | T InterpolateValue(T baseValue, double keyFrameProgress); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/AnimationUsingKeyFramesBase/ISegmentLengthProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Celestial.UIToolkit.Media.Animations 2 | { 3 | 4 | /// 5 | /// Used by the to calculate 6 | /// the distance between two elements for a paced animation. 7 | /// 8 | internal interface ISegmentLengthProvider 9 | { 10 | double GetDistanceBetween(object from, object to); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/AnimationUsingKeyFramesBase/ResolvedKeyFrameCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Extensions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Windows.Media.Animation; 6 | 7 | namespace Celestial.UIToolkit.Media.Animations 8 | { 9 | 10 | internal static class ResolvedKeyFrameCollectionExtensions 11 | { 12 | 13 | /// 14 | /// Goes through the sequence of resolved key frames and finds the frame, 15 | /// which is supposed to be used for an animation at the specified time. 16 | /// 17 | /// 18 | /// A sequence of instances. 19 | /// 20 | /// The animation's current time. 21 | /// 22 | /// The index in the sequence, which 23 | /// points to the key frame which is supposed to be played. 24 | /// 25 | public static int FindCurrentKeyFrameIndex( 26 | this IEnumerable> resolvedKeyFrames, TimeSpan currentTime) 27 | where TKeyFrame : IKeyFrame 28 | { 29 | if (resolvedKeyFrames == null) throw new ArgumentNullException(nameof(resolvedKeyFrames)); 30 | if (resolvedKeyFrames.Count() == 0) 31 | { 32 | throw new InvalidOperationException( 33 | "The resolved key frames sequence did not contain any frames. " + 34 | "Unable to find a correct frame for the specified time."); 35 | } 36 | 37 | int frameCount = resolvedKeyFrames.Count(); 38 | 39 | // Find the first frame whose time is >= currentTime, but 40 | // choose the last frame of a set of frames whose resolved time == currentTime. 41 | for (int i = 0; i < frameCount; i++) 42 | { 43 | var currentFrame = resolvedKeyFrames.ElementAt(i); 44 | var nextFrame = resolvedKeyFrames.ElementAfterOrDefault(i); 45 | bool isFrameAfterCurrentTime = currentFrame.ResolvedKeyTime >= currentTime; 46 | bool nextFrameEqualsCurrentTime = nextFrame != null && 47 | nextFrame.ResolvedKeyTime == currentTime; 48 | 49 | if (isFrameAfterCurrentTime && !nextFrameEqualsCurrentTime) 50 | return i; 51 | } 52 | return frameCount - 1; 53 | } 54 | 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/BrushAnimation/BrushKeyFrameCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | 5 | namespace Celestial.UIToolkit.Media.Animations 6 | { 7 | 8 | /// 9 | /// A freezable collection which is able to hold key frames of objects. 10 | /// 11 | public class BrushKeyFrameCollection : FreezableCollection> 12 | { 13 | 14 | /// 15 | /// Initializes a new, empty instance of the class. 16 | /// 17 | public BrushKeyFrameCollection() { } 18 | 19 | /// 20 | /// Initializes a new, empty instance of the class 21 | /// with the specified initial capacity. 22 | /// 23 | /// An initial capacity of elements. 24 | public BrushKeyFrameCollection(int capacity) 25 | : base(capacity) { } 26 | 27 | /// 28 | /// Initializes a new instance of the class 29 | /// with the specified as a source. 30 | /// 31 | /// 32 | /// A set of key frames which are copied into this collection. 33 | /// 34 | public BrushKeyFrameCollection(IEnumerable> keyFrames) 35 | : base(keyFrames) { } 36 | 37 | /// 38 | /// Creates a new instance of the class. 39 | /// 40 | /// A new instance. 41 | protected override Freezable CreateInstanceCore() => new BrushKeyFrameCollection(); 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/BrushAnimation/DiscreteBrushKeyFrame.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | using System.Windows.Media.Animation; 4 | 5 | namespace Celestial.UIToolkit.Media.Animations 6 | { 7 | 8 | /// 9 | /// Animates from the value of the previous key frame to 10 | /// its own using discrete interpolation. 11 | /// 12 | public class DiscreteBrushKeyFrame : DiscreteKeyFrameBase 13 | { 14 | 15 | /// 16 | /// Initializes a new instance of the class 17 | /// with default values. 18 | /// 19 | public DiscreteBrushKeyFrame() 20 | : base() { } 21 | 22 | /// 23 | /// Initializes a new instance of the class 24 | /// with the specified . 25 | /// 26 | /// The value which is associated with this key frame. 27 | public DiscreteBrushKeyFrame(Brush value) 28 | : base(value) { } 29 | 30 | /// 31 | /// Initializes a new instance of the class 32 | /// with the specified values. 33 | /// 34 | /// The value which is associated with this key frame. 35 | /// A value which is associated with this key frame. 36 | public DiscreteBrushKeyFrame(Brush value, KeyTime keyTime) 37 | : base(value, keyTime) { } 38 | 39 | /// 40 | /// Creates a new instance of the class. 41 | /// 42 | /// A new instance. 43 | protected override Freezable CreateInstanceCore() => new DiscreteBrushKeyFrame(); 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/BrushAnimation/EasingBrushKeyFrame.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | using System.Windows.Media.Animation; 4 | 5 | namespace Celestial.UIToolkit.Media.Animations 6 | { 7 | 8 | /// 9 | /// A key frame which allows you to associate easing functions with a 10 | /// animation. 11 | /// 12 | public class EasingBrushKeyFrame : EasingKeyFrameBase 13 | { 14 | 15 | /// 16 | /// Creates a new instance of the class. 17 | /// 18 | /// A new instance. 19 | protected override Freezable CreateInstanceCore() => new EasingBrushKeyFrame(); 20 | 21 | /// 22 | /// Calculates the value of a key frame at the progress increment provided. 23 | /// 24 | /// The value to animate from; typically the value of the previous key frame. 25 | /// 26 | /// A value between 0.0 and 1.0, inclusive, that specifies the percentage of time 27 | /// that has elapsed for this key frame. 28 | /// This value has already been eased by the . 29 | /// 30 | /// The output value of this key frame given the specified base value and progress. 31 | protected override Brush InterpolateValueAfterEase(Brush baseValue, double easedProgress) 32 | { 33 | if (easedProgress <= 0) return baseValue; 34 | if (easedProgress >= 1) return Value; 35 | BrushAnimationValidator.ValidateBrushes(baseValue, Value); 36 | return BrushAnimationHelper.Instance.InterpolateValue(baseValue, Value, easedProgress); 37 | } 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/BrushAnimation/LinearBrushKeyFrame.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace Celestial.UIToolkit.Media.Animations 5 | { 6 | 7 | /// 8 | /// Animates from the value of the previous key frame to its own 9 | /// using linear interpolation. 10 | /// 11 | public class LinearBrushKeyFrame : KeyFrameBase 12 | { 13 | 14 | /// 15 | /// Creates a new instance of the class. 16 | /// 17 | /// A new instance. 18 | protected override Freezable CreateInstanceCore() => new LinearBrushKeyFrame(); 19 | 20 | /// 21 | /// Calculates the value of a key frame at the progress increment provided. 22 | /// 23 | /// The value to animate from; typically the value of the previous key frame. 24 | /// 25 | /// A value between 0.0 and 1.0, inclusive, that specifies the percentage of time 26 | /// that has elapsed for this key frame. 27 | /// 28 | /// The output value of this key frame given the specified base value and progress. 29 | protected override Brush InterpolateValueCore(Brush baseValue, double keyFrameProgress) 30 | { 31 | if (keyFrameProgress <= 0) return baseValue; 32 | if (keyFrameProgress >= 1) return Value; 33 | BrushAnimationValidator.ValidateBrushes(baseValue, Value); 34 | return BrushAnimationHelper.Instance.InterpolateValue(baseValue, Value, keyFrameProgress); 35 | } 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Media/Animations/BrushAnimation/SplineBrushKeyFrame.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | using System.Windows.Media.Animation; 4 | 5 | namespace Celestial.UIToolkit.Media.Animations 6 | { 7 | 8 | /// 9 | /// Animates from the value of the previous key frame to its own 10 | /// using splined interpolation. 11 | /// 12 | public class SplineBrushKeyFrame : SplineKeyFrameBase 13 | { 14 | 15 | /// 16 | /// Creates a new instance of the class. 17 | /// 18 | /// A new instance. 19 | protected override Freezable CreateInstanceCore() => new SplineBrushKeyFrame(); 20 | 21 | /// 22 | /// Calculates the value of a key frame at the progress increment provided. 23 | /// 24 | /// The value to animate from; typically the value of the previous key frame. 25 | /// 26 | /// A value between 0.0 and 1.0, inclusive, that specifies the percentage of time 27 | /// that has elapsed for this key frame. 28 | /// The has already been applied to this progress. 29 | /// 30 | /// The output value of this key frame given the specified base value and progress. 31 | protected override Brush InterpolateValueWithSplineProgress(Brush baseValue, double splineProgress) 32 | { 33 | if (splineProgress <= 0) return baseValue; 34 | if (splineProgress >= 1) return Value; 35 | BrushAnimationValidator.ValidateBrushes(baseValue, Value); 36 | return BrushAnimationHelper.Instance.InterpolateValue(baseValue, Value, splineProgress); 37 | } 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Windows; 5 | using System.Windows.Markup; 6 | 7 | [assembly: InternalsVisibleTo("Celestial.UIToolkit")] 8 | [assembly: InternalsVisibleTo("Celestial.UIToolkit.Core.Tests")] 9 | 10 | [assembly: ThemeInfo( 11 | ResourceDictionaryLocation.None, 12 | ResourceDictionaryLocation.SourceAssembly 13 | )] 14 | 15 | [assembly: XmlnsDefinition("http://celestial-ui.com", "Celestial.UIToolkit")] 16 | [assembly: XmlnsDefinition("http://celestial-ui.com", "Celestial.UIToolkit.Converters")] 17 | [assembly: XmlnsDefinition("http://celestial-ui.com", "Celestial.UIToolkit.Media")] 18 | [assembly: XmlnsDefinition("http://celestial-ui.com", "Celestial.UIToolkit.Media.Animations")] 19 | [assembly: XmlnsDefinition("http://celestial-ui.com", "Celestial.UIToolkit.Xaml")] 20 | [assembly: XmlnsPrefix("http://celestial-ui.com", "c")] 21 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Xaml/BindingExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Data; 2 | 3 | namespace Celestial.UIToolkit.Xaml 4 | { 5 | // The purpose of these classes is to make XAML Code more compact. 6 | // For instance, instead of 7 | // 8 | // Value="{Binding MyProperty, RelativeSource={RelativeSource TemplatedParent}} 9 | // 10 | // we can write 11 | // 12 | // Value="{c:TemplatedParentBinding MyProperty} 13 | // 14 | // which, as you can see, is about half the size. 15 | 16 | 17 | /// 18 | /// An otherwise normal whose 19 | /// property is set to . 20 | /// 21 | public class SelfBindingExtension : Binding 22 | { 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | public SelfBindingExtension() 28 | : this(null) { } 29 | 30 | /// 31 | /// Initializes a new instance of the class. 32 | /// 33 | /// 34 | /// The initial for the binding. 35 | /// 36 | public SelfBindingExtension(string path) 37 | : base(path) 38 | { 39 | RelativeSource = RelativeSource.Self; 40 | } 41 | 42 | } 43 | 44 | /// 45 | /// An otherwise normal whose 46 | /// property is set to . 47 | /// 48 | public class TemplatedParentBindingExtension : Binding 49 | { 50 | 51 | /// 52 | /// Initializes a new instance of the class. 53 | /// 54 | public TemplatedParentBindingExtension() 55 | : this(null) { } 56 | 57 | /// 58 | /// Initializes a new instance of the class. 59 | /// 60 | /// 61 | /// The initial for the binding. 62 | /// 63 | public TemplatedParentBindingExtension(string path) 64 | : base(path) 65 | { 66 | RelativeSource = RelativeSource.TemplatedParent; 67 | } 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Xaml/BindingProxy.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Windows; 3 | using System.Windows.Markup; 4 | 5 | namespace Celestial.UIToolkit.Xaml 6 | { 7 | 8 | // Taken from https://stackoverflow.com/a/42488470/10018492 and 9 | // https://stackoverflow.com/a/22074985/424129. 10 | // Bless the persons who came up with this.. 11 | 12 | /// 13 | /// A class which is used to allow bindings in places where they wouldn't normally be possible, 14 | /// by creating a proxy between the two parties. 15 | /// 16 | [DebuggerDisplay(nameof(Data) + ": {" + nameof(Data) + "}")] 17 | [ContentProperty(nameof(Data))] 18 | public class BindingProxy : Freezable 19 | { 20 | 21 | /// 22 | /// Identifies the dependency property. 23 | /// 24 | public static readonly DependencyProperty DataProperty = DependencyProperty.Register( 25 | nameof(Data), typeof(object), typeof(BindingProxy), new PropertyMetadata(null)); 26 | 27 | /// 28 | /// Gets or sets the data which this object is proxying. 29 | /// 30 | public object Data 31 | { 32 | get => GetValue(DataProperty); 33 | set => SetValue(DataProperty, value); 34 | } 35 | 36 | /// 37 | /// Initializes a new instance of the class. 38 | /// 39 | public BindingProxy() { } 40 | 41 | /// 42 | /// Initializes a new instance of the class with the 43 | /// specified . 44 | /// 45 | /// The data which this object is proxying. 46 | public BindingProxy(object data) 47 | { 48 | Data = data; 49 | } 50 | 51 | /// 52 | /// Creates a new instance of the class. 53 | /// 54 | /// A new instance of the class. 55 | protected override Freezable CreateInstanceCore() => new BindingProxy(); 56 | 57 | /// 58 | /// Returns a string representation of the proxy's . 59 | /// 60 | /// A representing the proxy's data. 61 | public override string ToString() 62 | { 63 | return Data?.ToString() ?? ""; 64 | } 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Xaml/DesignTimeOnlyResourceDictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using static Celestial.UIToolkit.TraceSources; 4 | 5 | namespace Celestial.UIToolkit.Xaml 6 | { 7 | 8 | /// 9 | /// A special resource dictionary which only loads its content, if it is currently in the 10 | /// design mode. 11 | /// Otherwise, the loading process will simply be ignored. 12 | /// 13 | public class DesignTimeOnlyResourceDictionary : ResourceDictionary 14 | { 15 | 16 | private Uri _source; 17 | 18 | /// 19 | /// Gets a value indicating whether the dictionary has loaded any content. 20 | /// 21 | public bool IsLoaded => base.Source != null; 22 | 23 | /// 24 | /// Gets or sets the source of the resource dictionary. 25 | /// 26 | public new Uri Source 27 | { 28 | get { return _source; } 29 | set 30 | { 31 | _source = value; 32 | if (DesignMode.IsEnabled) 33 | { 34 | base.Source = value; 35 | ResourcesSource.TraceInformation( 36 | "Loaded design time resource dictionary at {0}", Source); 37 | } 38 | else 39 | { 40 | ResourcesSource.TraceInformation( 41 | "Skipping design time resource dictionary at {0}", Source); 42 | } 43 | } 44 | } 45 | 46 | /// 47 | /// Returns a string which represents the current state of the resource dictionary. 48 | /// 49 | /// A string representing the current state of the resource dictionary. 50 | public override string ToString() 51 | { 52 | return $"{nameof(DesignTimeOnlyResourceDictionary)}: " + 53 | $"{nameof(IsLoaded)}: {IsLoaded}, " + 54 | $"{nameof(Source)}: {Source}"; 55 | } 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Core/Xaml/ThemeChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Celestial.UIToolkit.Xaml 4 | { 5 | 6 | /// 7 | /// Provides event data for the changed event. 8 | /// 9 | public class ThemeChangedEventArgs : EventArgs 10 | { 11 | 12 | /// 13 | /// Gets the name of the new theme. 14 | /// This can be null. 15 | /// 16 | public string ThemeName { get; } 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// 22 | /// The name of the new theme. This can be null. 23 | /// 24 | public ThemeChangedEventArgs(string themeName) 25 | { 26 | ThemeName = themeName; 27 | } 28 | 29 | /// 30 | /// Returns a string representation of this instance. 31 | /// 32 | /// A string representing this instance. 33 | public override string ToString() 34 | { 35 | return $"{nameof(ThemeChangedEventArgs)}: " + 36 | $"{nameof(ThemeName)}: {ThemeName}"; 37 | } 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Tests/Celestial.UIToolkit.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net46 6 | 7 | Properties 8 | 9 | False 10 | 11 | 12 | 13 | 14 | 15 | 16 | all 17 | runtime; build; native; contentfiles; analyzers 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Tests/Controls/NavigationViewTests/MenuItemsTests.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Controls; 2 | using Celestial.UIToolkit.Extensions; 3 | using System.Linq; 4 | using Xunit; 5 | 6 | namespace Celestial.UIToolkit.Tests.Controls.NavigationViewTests 7 | { 8 | 9 | public class MenuItemsTests 10 | { 11 | 12 | //[WpfFact] 13 | //public void FiresSelectedItemChanged() 14 | //{ 15 | // var navView = new NavigationView(); 16 | // navView.MenuItems.AddRange(new object[] { 1, 2, 3, "Four", "Five" }); 17 | 18 | // Assert.Raises( 19 | // (handler) => navView.SelectedItemChanged += handler, 20 | // (handler) => navView.SelectedItemChanged -= handler, 21 | // () => navView.SelectedItem = navView.MenuItems.First()); 22 | //} 23 | 24 | //[WpfFact] 25 | //public void CanOnlySwitchToKnownSelectedMenuItem() 26 | //{ 27 | // var navView = new NavigationView(); 28 | // navView.MenuItems.Add("ExistingItem"); 29 | 30 | // navView.SelectedItem = 1; // Does not exist in MenuItems collection. 31 | // Assert.Null(navView.SelectedItem); 32 | 33 | // navView.SelectedItem = navView.MenuItems.First(); 34 | // Assert.NotNull(navView.SelectedItem); 35 | //} 36 | 37 | //[WpfFact] 38 | //public void CanSetItemsViaItemsSource() 39 | //{ 40 | // var navView = new NavigationView(); 41 | // var itemsSource = new int[] { 1, 2, 3 }; 42 | 43 | // navView.MenuItemsSource = itemsSource; 44 | // Assert.True( 45 | // navView.MenuItems.Cast().SequenceEqual(itemsSource)); 46 | //} 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit.Tests/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Celestial.UIToolkit.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net45 6 | 7 | Properties 8 | 9 | true 10 | true 11 | 12 | 13 | The assembly which contains the graphical elements of the Celestial UIToolkit. 14 | Included are XAML files and templates which allow you to quickly style your application. 15 | wpf;ui;toolkit;animation;markup;extensions;vsm;visual;state;manager;resources;styles;templates;uwp;material;design; 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/Card/Card.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace Celestial.UIToolkit.Controls 5 | { 6 | 7 | /// 8 | /// A which depicts a card. 9 | /// In addition to the the , 10 | /// the provides a set of additional content properties 11 | /// like and to organize the 12 | /// content into structured parts. 13 | /// This allows control templates to change the arrangement of the card's 14 | /// different elements, while giving the user full control over what the 15 | /// content looks like. 16 | /// 17 | /// 18 | /// At its core, a card is nothing else but a glorified border which hosts 19 | /// content. 20 | /// In terms of design language, a card is a contained, independent unit 21 | /// which displays and organizes content. 22 | /// Learn more about cards at: 23 | /// https://material.io/design/components/cards.html#anatomy 24 | /// 25 | public partial class Card : ContentControl 26 | { 27 | 28 | // Most properties of this class are auto-generated. 29 | // See the corresponding .tt file. 30 | 31 | static Card() 32 | { 33 | DefaultStyleKeyProperty.OverrideMetadata( 34 | typeof(Card), new FrameworkPropertyMetadata(typeof(Card))); 35 | } 36 | 37 | /// 38 | /// Initializes a new instance of the class. 39 | /// 40 | public Card() 41 | { 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/NavigationView/NavigationView.Header.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace Celestial.UIToolkit.Controls 5 | { 6 | 7 | public partial class NavigationView 8 | { 9 | 10 | /// 11 | /// Identifies the dependency property. 12 | /// 13 | public static readonly DependencyProperty AlwaysShowHeaderProperty = 14 | DependencyProperty.Register( 15 | nameof(AlwaysShowHeader), 16 | typeof(bool), 17 | typeof(NavigationView), 18 | new PropertyMetadata(true)); 19 | 20 | /// 21 | /// Gets or sets a value indicating whether the 22 | /// content of this is always visible. 23 | /// If false, the header is only shown, when the is in the 24 | /// display mode. 25 | /// 26 | public bool AlwaysShowHeader 27 | { 28 | get { return (bool)GetValue(AlwaysShowHeaderProperty); } 29 | set { SetValue(AlwaysShowHeaderProperty, value); } 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/NavigationView/NavigationView.VisualStates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace Celestial.UIToolkit.Controls 5 | { 6 | 7 | [TemplateVisualState(Name = MinimalVisualState, GroupName = DisplayModeStatesVisualStateGroup)] 8 | [TemplateVisualState(Name = CompactVisualState, GroupName = DisplayModeStatesVisualStateGroup)] 9 | [TemplateVisualState(Name = ExpandedVisualState, GroupName = DisplayModeStatesVisualStateGroup)] 10 | public partial class NavigationView 11 | { 12 | 13 | /// 14 | /// Defines the name of the "DisplayModeStates" Visual State Group. 15 | /// 16 | public const string DisplayModeStatesVisualStateGroup = "DisplayModeStates"; 17 | 18 | /// 19 | /// Defines the name of the "Minimal" Visual State. 20 | /// 21 | public const string MinimalVisualState = "Minimal"; 22 | 23 | /// 24 | /// Defines the name of the "Compact" Visual State. 25 | /// 26 | public const string CompactVisualState = "Compact"; 27 | 28 | /// 29 | /// Defines the name of the "Expanded" Visual State. 30 | /// 31 | public const string ExpandedVisualState = "Expanded"; 32 | 33 | private void EnterCurrentDisplayModeVisualState() 34 | { 35 | EnterCurrentDisplayModeVisualState(true); 36 | } 37 | 38 | private void EnterCurrentDisplayModeVisualState(bool useTransitions) 39 | { 40 | switch (DisplayMode) 41 | { 42 | case NavigationViewDisplayMode.Minimal: 43 | VisualStateManager.GoToState(this, MinimalVisualState, useTransitions); 44 | break; 45 | case NavigationViewDisplayMode.Compact: 46 | VisualStateManager.GoToState(this, CompactVisualState, useTransitions); 47 | break; 48 | case NavigationViewDisplayMode.Expanded: 49 | VisualStateManager.GoToState(this, ExpandedVisualState, useTransitions); 50 | break; 51 | default: 52 | throw new NotImplementedException(); 53 | } 54 | } 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/NavigationView/NavigationViewDisplayMode.cs: -------------------------------------------------------------------------------- 1 | namespace Celestial.UIToolkit.Controls 2 | { 3 | 4 | /// 5 | /// Defines the different display modes of a control. 6 | /// 7 | public enum NavigationViewDisplayMode 8 | { 9 | 10 | /// 11 | /// The displays only the minimal amount of elements, 12 | /// which happens to be the menu button. 13 | /// With this button, the pane can be shown and hidden. 14 | /// 15 | Minimal, 16 | 17 | /// 18 | /// The shows a small strip which can be expanded via the 19 | /// menu button. 20 | /// 21 | Compact, 22 | 23 | /// 24 | /// The is fully expanded, meaning that the pane stays open 25 | /// the whole time. 26 | /// 27 | Expanded 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/NavigationView/NavigationViewDisplayModeChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Celestial.UIToolkit.Controls 4 | { 5 | 6 | /// 7 | /// Provides event data for the event. 8 | /// This class cannot be inherited. 9 | /// 10 | [Serializable] 11 | public sealed class NavigationViewDisplayModeChangedEventArgs : EventArgs 12 | { 13 | 14 | /// 15 | /// Gets the old display mode. 16 | /// 17 | public NavigationViewDisplayMode OldDisplayMode { get; } 18 | 19 | /// 20 | /// Gets the new display mode. 21 | /// 22 | public NavigationViewDisplayMode NewDisplayMode { get; } 23 | 24 | /// 25 | /// Initializes a new instance of the 26 | /// class with the specified 27 | /// event data. 28 | /// 29 | /// The old display mode. 30 | /// The new display mode. 31 | public NavigationViewDisplayModeChangedEventArgs( 32 | NavigationViewDisplayMode oldDisplayMode, 33 | NavigationViewDisplayMode newDisplayMode) 34 | { 35 | OldDisplayMode = oldDisplayMode; 36 | NewDisplayMode = newDisplayMode; 37 | } 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/NavigationView/NavigationViewItemEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Celestial.UIToolkit.Controls 4 | { 5 | 6 | /// 7 | /// Provides generic event data regarding a single item 8 | /// which is hosted by a . 9 | /// 10 | public class NavigationViewItemEventArgs : EventArgs 11 | { 12 | 13 | /// 14 | /// Gets the item to which this event data object refers. 15 | /// 16 | public object Item { get; } 17 | 18 | /// 19 | /// Gets a value indicating whether the is the special 20 | /// settings navigation item. 21 | /// 22 | public bool IsSettingsItem { get; } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// The item to which this event data object refers. 28 | public NavigationViewItemEventArgs(object item) 29 | : this(item, false) { } 30 | 31 | /// 32 | /// Initializes a new instance of the class. 33 | /// 34 | /// The item to which this event data object refers. 35 | /// 36 | /// A value indicating whether the is the special settings 37 | /// navigation item. 38 | /// 39 | public NavigationViewItemEventArgs(object item, bool isSettingsItem) 40 | { 41 | Item = item; 42 | IsSettingsItem = isSettingsItem; 43 | } 44 | 45 | /// 46 | /// Returns a string representation of this event data object. 47 | /// 48 | /// A string representing this object. 49 | public override string ToString() 50 | { 51 | return $"{nameof(Item)}: {Item}, {nameof(IsSettingsItem)}: {IsSettingsItem}"; 52 | } 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/NavigationView/NavigationViewListView.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace Celestial.UIToolkit.Controls 5 | { 6 | 7 | /// 8 | /// A custom which is supposed to be used with a 9 | /// for displaying the . 10 | /// In comparison to a normal , this class provides events for when 11 | /// an item gets invoked, creates container elements by 12 | /// default and disallows Keyboard Navigation. 13 | /// 14 | [StyleTypedProperty(Property = nameof(ItemContainerStyle), StyleTargetType = typeof(NavigationViewItem))] 15 | public class NavigationViewListView : ExtendedListView 16 | { 17 | 18 | static NavigationViewListView() 19 | { 20 | DefaultStyleKeyProperty.OverrideMetadata( 21 | typeof(NavigationViewListView), 22 | new FrameworkPropertyMetadata(typeof(NavigationViewListView))); 23 | } 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | public NavigationViewListView() 29 | { 30 | } 31 | 32 | /// 33 | /// Creates and returns a new container. 34 | /// 35 | /// A new . 36 | protected override DependencyObject GetContainerForItemOverride() 37 | { 38 | return new NavigationViewItem(); 39 | } 40 | 41 | /// 42 | /// Returns a value indicating whether the is of type 43 | /// . 44 | /// 45 | /// The item to be checked. 46 | /// 47 | /// true if is an ; 48 | /// false if not. 49 | /// 50 | protected override bool IsItemItsOwnContainerOverride(object item) 51 | { 52 | return item is NavigationViewItem; 53 | } 54 | 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/PlaceholderOverlay/PlaceholderDisplayType.cs: -------------------------------------------------------------------------------- 1 | namespace Celestial.UIToolkit.Controls 2 | { 3 | 4 | /// 5 | /// Defines the different display types of a placeholder. 6 | /// 7 | public enum PlaceholderDisplayType 8 | { 9 | 10 | /// 11 | /// The placeholder is always visible. 12 | /// If space is required, the placeholder moves to a place where it doesn't use up 13 | /// the content's space. 14 | /// 15 | Floating, 16 | 17 | /// 18 | /// When the content requires space, the placeholder disappears. 19 | /// 20 | Disappearing 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/ShadowControls/DirectionalThemeShadow.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace Celestial.UIToolkit.Controls 5 | { 6 | 7 | /// 8 | /// A which moves the shadow in a certain direction, 9 | /// defined by the property. 10 | /// 11 | public class DirectionalThemeShadow : ThemeShadow 12 | { 13 | 14 | /// 15 | /// Gets or sets the direction in which the shadow is pointing. 16 | /// 17 | public Dock ShadowDirection { get; set; } 18 | 19 | /// 20 | /// Gets or sets a value with which the calculated shadow offset values are multiplied 21 | /// before being applied to the shadow. 22 | /// 23 | public double DirectionOffsetMultiplier { get; set; } 24 | 25 | /// 26 | /// Initializes a new instance of the which points 27 | /// to the Bottom. 28 | /// 29 | public DirectionalThemeShadow() 30 | { 31 | // By default, 4 elevation levels should equal one pixel. 32 | DirectionOffsetMultiplier = 0.25; 33 | ShadowDirection = Dock.Bottom; 34 | } 35 | 36 | /// 37 | /// Calculates the shadow's offset, based on the . 38 | /// 39 | /// The shadow casting element. 40 | /// 41 | /// A which is the final location of the shadow. 42 | /// 43 | protected override Vector CalculateCurrentShadowOffset(DependencyObject element) 44 | { 45 | // Move the Shadow by the Current Elevation Level. 46 | double elevation = GetElevation(element) * DirectionOffsetMultiplier; 47 | 48 | switch (ShadowDirection) 49 | { 50 | case Dock.Left: 51 | return new Vector(-elevation, 0d); 52 | case Dock.Right: 53 | return new Vector(elevation, 0d); 54 | case Dock.Top: 55 | return new Vector(0d, elevation); 56 | case Dock.Bottom: 57 | return new Vector(0d, -elevation); 58 | default: 59 | return base.CalculateCurrentShadowOffset(element); 60 | } 61 | } 62 | 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/SplitView/SplitView.Events.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Celestial.UIToolkit.Controls 4 | { 5 | 6 | public partial class SplitView 7 | { 8 | 9 | /// 10 | /// Occurs when the pane is closing. 11 | /// 12 | public event EventHandler PaneClosing; 13 | 14 | /// 15 | /// Occurs when the pane is closed. 16 | /// 17 | public event EventHandler PaneClosed; 18 | 19 | /// 20 | /// Occurs when the pane is opening. 21 | /// 22 | public event EventHandler PaneOpening; 23 | 24 | /// the pane is opened. 25 | /// Occurs when 26 | /// 27 | public event EventHandler PaneOpened; 28 | 29 | /// 30 | /// Raises the event. 31 | /// 32 | protected virtual void OnPaneClosing() 33 | { 34 | PaneClosing?.Invoke(this, EventArgs.Empty); 35 | } 36 | 37 | /// 38 | /// Raises the event. 39 | /// 40 | protected virtual void OnPaneClosed() 41 | { 42 | PaneClosed?.Invoke(this, EventArgs.Empty); 43 | } 44 | 45 | /// 46 | /// Raises the event. 47 | /// 48 | protected virtual void OnPaneOpening() 49 | { 50 | PaneOpening?.Invoke(this, EventArgs.Empty); 51 | } 52 | 53 | /// 54 | /// Raises the event. 55 | /// 56 | protected virtual void OnPaneOpened() 57 | { 58 | PaneOpened?.Invoke(this, EventArgs.Empty); 59 | } 60 | 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/SplitView/SplitViewDisplayMode.cs: -------------------------------------------------------------------------------- 1 | namespace Celestial.UIToolkit.Controls 2 | { 3 | 4 | /// 5 | /// Definesthe different display modes of a control. 6 | /// 7 | public enum SplitViewDisplayMode 8 | { 9 | 10 | /// 11 | /// When opened, the pane hovers over the content. 12 | /// When closed, the pane is no longer visible. 13 | /// 14 | Overlay, 15 | 16 | /// 17 | /// When opened, the pane is displayed next to the content and takes up space. 18 | /// When closed, the pane is no longer visible and thus doesn't take up space anymore. 19 | /// 20 | Inline, 21 | 22 | /// 23 | /// The pane always takes up a small amount of space. 24 | /// When opened, the pane expands to the full size. The expanded area hovers over the 25 | /// content. 26 | /// When closed, the pane is reduced to the strip. 27 | /// 28 | CompactOverlay, 29 | 30 | /// 31 | /// When opened, the pane expands to the full size and takes up the required space. 32 | /// When closed, the pane is reduced to a strip which still takes up space. 33 | /// This is essentially the same as , with the only difference 34 | /// being that the pane always takes up space. 35 | /// 36 | CompactInline 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Controls/SplitView/SplitViewPanePlacement.cs: -------------------------------------------------------------------------------- 1 | namespace Celestial.UIToolkit.Controls 2 | { 3 | 4 | /// 5 | /// Defines on which side the pane of a control is placed. 6 | /// 7 | public enum SplitViewPanePlacement 8 | { 9 | 10 | /// 11 | /// The pane is placed on the left. 12 | /// 13 | Left, 14 | 15 | /// 16 | /// The pane is placed on the right. 17 | /// 18 | Right 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Icons/All.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Icons/Badges.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Icons/Weather.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | F1 M 32,19C 39.1797,19 45,24.8203 45,32C 45,39.1797 39.1797,45 32,45C 24.8203,45 19,39.1797 19,32C 19,24.8203 24.8203,19 32,19 Z M 14.8958,33.4L 0.00010043,33.4L 6.35782e-007,30.6L 14.8958,30.6L 14.8958,33.4 Z M 30.6,63.9999L 30.6,49.1042L 33.4,49.1041L 33.4,63.9999L 30.6,63.9999 Z M 7.99999,54.0201L 18.5329,43.4872L 20.5128,45.4671L 9.97989,56L 7.99999,54.0201 Z M 64,33.4L 49.1041,33.4L 49.1041,30.6L 64,30.5999L 64,33.4 Z M 33.4,4.19617e-005L 33.4,14.8959L 30.6,14.8959L 30.6,4.19617e-005L 33.4,4.19617e-005 Z M 56,9.97989L 45.467,20.5128L 43.4871,18.5329L 54.0201,8L 56,9.97989 Z M 9.97991,7.99998L 20.5128,18.5329L 18.533,20.5128L 8.00001,9.97988L 9.97991,7.99998 Z M 54.0202,56L 43.4872,45.467L 45.4671,43.4871L 56.0001,54.0201L 54.0202,56 Z 7 | 8 | 9 | 10 | F1 M 32,64C 14.3269,64 -2.54313e-006,49.6731 -2.54313e-006,32C -2.54313e-006,16.6055 10.8706,3.75006 25.3544,0.690968C 20.9497,5.97874 18.3,12.7799 18.3,20.2C 18.3,37.0447 31.9553,50.7 48.8,50.7C 52.4475,50.7 55.9454,50.0597 59.1875,48.8855C 53.5397,57.9599 43.4752,64 32,64 Z 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Windows; 5 | using System.Windows.Markup; 6 | 7 | // Allow the Test Project to see (and test) internal classes. 8 | [assembly: InternalsVisibleTo("Celestial.UIToolkit.Tests")] 9 | 10 | [assembly: ThemeInfo( 11 | ResourceDictionaryLocation.None, 12 | ResourceDictionaryLocation.SourceAssembly 13 | )] 14 | 15 | [assembly: XmlnsDefinition("http://celestial-ui.com", "Celestial.UIToolkit.Controls")] 16 | [assembly: XmlnsDefinition("http://celestial-ui.com", "Celestial.UIToolkit.Theming")] 17 | [assembly: XmlnsPrefix("http://celestial-ui.com", "c")] 18 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Styles/Controls/ContentControl.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 12 | 13 | 12 | 13 | 20 | 21 | 25 | 26 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Styles/Controls/TextBlock.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 13 | 25 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Styles/Shared/FocusVisuals.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 16 | 17 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Theming/ControlProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Celestial.UIToolkit.Theming 4 | { 5 | 6 | /// 7 | /// Provides attached dependency properties for generic control properties 8 | /// which can be used by styles. 9 | /// 10 | public static class ControlProperties 11 | { 12 | 13 | /// 14 | /// Identifies the CornerRadius attached dependency property. 15 | /// 16 | public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached( 17 | "CornerRadius", typeof(CornerRadius), typeof(ControlProperties), new PropertyMetadata(new CornerRadius())); 18 | 19 | /// 20 | /// Gets the value of the attached dependency property 21 | /// for a given . 22 | /// 23 | /// 24 | /// The for which the local value of the 25 | /// attached dependency property 26 | /// should be retrieved. 27 | /// 28 | /// 29 | /// The local value of the attached dependency property, 30 | /// which is of type . 31 | /// 32 | public static CornerRadius GetCornerRadius(DependencyObject obj) 33 | { 34 | return (CornerRadius)obj.GetValue(CornerRadiusProperty); 35 | } 36 | 37 | /// 38 | /// Sets the value of the attached dependency property 39 | /// for a given . 40 | /// 41 | /// 42 | /// The for which the local value of the 43 | /// attached dependency property 44 | /// should be set. 45 | /// 46 | /// 47 | /// The new value for the dependency property. 48 | /// 49 | public static void SetCornerRadius(DependencyObject obj, CornerRadius value) 50 | { 51 | obj.SetValue(CornerRadiusProperty, value); 52 | } 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Theming/RippleProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Celestial.UIToolkit.Theming 4 | { 5 | 6 | /// 7 | /// Provides attached dependency properties for controls which display 8 | /// a ripple animation. 9 | /// 10 | public static class RippleProperties 11 | { 12 | 13 | /// 14 | /// Identifies the ShowRippleAnimation attached dependency property. 15 | /// 16 | public static readonly DependencyProperty ShowRippleAnimationProperty = DependencyProperty.RegisterAttached( 17 | "ShowRippleAnimation", typeof(bool), typeof(RippleProperties), new PropertyMetadata(true)); 18 | 19 | /// 20 | /// Gets the value of the attached dependency property 21 | /// for a given . 22 | /// 23 | /// 24 | /// The for which the local value of the 25 | /// attached dependency property 26 | /// should be retrieved. 27 | /// 28 | /// 29 | /// The local value of the attached dependency property, 30 | /// which is of type . 31 | /// 32 | public static bool GetShowRippleAnimation(DependencyObject obj) 33 | { 34 | return (bool)obj.GetValue(ShowRippleAnimationProperty); 35 | } 36 | 37 | /// 38 | /// Sets the value of the attached dependency property 39 | /// for a given . 40 | /// 41 | /// 42 | /// The for which the local value of the 43 | /// attached dependency property 44 | /// should be set. 45 | /// 46 | /// 47 | /// The new value for the dependency property. 48 | /// 49 | public static void SetShowRippleAnimation(DependencyObject obj, bool value) 50 | { 51 | obj.SetValue(ShowRippleAnimationProperty, value); 52 | } 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Theming/ShadowProperties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Celestial.UIToolkit.Theming 4 | { 5 | 6 | /// 7 | /// Identifies attached dependency properties which can change an element's 8 | /// shadow. 9 | /// 10 | public class ShadowProperties 11 | { 12 | 13 | /// 14 | /// Occurs when the property changes. 15 | /// 16 | public static event EventHandler AreShadowsEnabledChanged; 17 | 18 | private static bool _areShadowsEnabled = true; 19 | 20 | /// 21 | /// Gets or sets a value which can be used to enable or disable shadows on an application 22 | /// level. 23 | /// 24 | public static bool AreShadowsEnabled 25 | { 26 | get { return _areShadowsEnabled; } 27 | set 28 | { 29 | if (_areShadowsEnabled != value) 30 | { 31 | _areShadowsEnabled = value; 32 | AreShadowsEnabledChanged?.Invoke(null, EventArgs.Empty); 33 | } 34 | } 35 | } 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Theming/TreeViewHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace Celestial.UIToolkit.Theming 5 | { 6 | 7 | /// 8 | /// Provides members which are required for implementing the default style of a 9 | /// . 10 | /// 11 | internal static class TreeViewHelper 12 | { 13 | 14 | /// 15 | /// An attached dependency property which is used to get and set the depth of a 16 | /// TreeViewItem from a style. 17 | /// Check the example for seeing how this can be implemented. 18 | /// 19 | /// 20 | /// <Setter Property="theming:TreeViewHelper.DepthLevel"> 21 | /// <Setter.Value> 22 | /// <Binding Path="(theming:TreeViewHelper.DepthLevel)" 23 | /// RelativeSource="{RelativeSource AncestorType=TreeViewItem}" 24 | /// FallbackValue="0" 25 | /// TargetNullValue="0" 26 | /// ConverterParameter="1"> 27 | /// <Binding.Converter> 28 | /// <c:MathOperationConverter Operator="Add" /> 29 | /// </Binding.Converter> 30 | /// </Binding> 31 | /// </Setter.Value> 32 | /// </Setter> 33 | /// 34 | public static readonly DependencyProperty DepthLevelProperty = 35 | DependencyProperty.RegisterAttached( 36 | "DepthLevel", 37 | typeof(int), 38 | typeof(TreeViewHelper), 39 | new PropertyMetadata(0)); 40 | 41 | public static int GetDepthLevel(DependencyObject obj) => 42 | (int)obj.GetValue(DepthLevelProperty); 43 | 44 | public static void SetDepthLevel(DependencyObject obj, int value) => 45 | obj.SetValue(DepthLevelProperty, value); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Xaml/ApplicationTheme.cs: -------------------------------------------------------------------------------- 1 | namespace Celestial.UIToolkit.Xaml 2 | { 3 | 4 | /// 5 | /// Defines the application themes which are supported by the toolkit out of the box. 6 | /// 7 | public enum ApplicationTheme 8 | { 9 | 10 | /// 11 | /// The application uses the Light theme. 12 | /// 13 | Light, 14 | 15 | /// 16 | /// The application uses the Dark theme. 17 | /// 18 | Dark 19 | 20 | } 21 | 22 | internal static class ApplicationThemeExtensions 23 | { 24 | 25 | public static string ToThemeName(this ApplicationTheme theme) 26 | { 27 | switch (theme) 28 | { 29 | // This could probably all be done via Enum.ToString(), 30 | // but if, for some reason, it gets refactored, I want to ensure backwards 31 | // compatibility. 32 | case ApplicationTheme.Light: 33 | return "Light"; 34 | case ApplicationTheme.Dark: 35 | return "Dark"; 36 | default: 37 | return theme.ToString(); 38 | } 39 | } 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/Celestial.UIToolkit/Xaml/ThemeManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Celestial.UIToolkit.Xaml 2 | { 3 | 4 | /// 5 | /// Provides extension methods to the class. 6 | /// 7 | public static class ThemeManagerExtensions 8 | { 9 | 10 | /// 11 | /// Sets the current theme to one of the toolkit's valid themes. 12 | /// 13 | /// The . 14 | /// The requested application theme. 15 | public static void ChangeTheme(this ThemeManager themeManager, ApplicationTheme theme) 16 | { 17 | themeManager.ChangeTheme(theme.ToThemeName()); 18 | } 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/ControlGallery/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/ControlGallery/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/ControlGallery/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Xaml; 2 | using ICSharpCode.AvalonEdit.Highlighting; 3 | using ICSharpCode.AvalonEdit.Highlighting.Xshd; 4 | using ShowMeTheXAML; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Windows; 8 | using System.Xml; 9 | 10 | namespace ControlGallery 11 | { 12 | 13 | public partial class App : Application 14 | { 15 | 16 | public App() 17 | { 18 | // Important: Load this here, because otherwise, the XAML won't be able to see them. 19 | LoadAvalonEditEmbeddedXshdDefinitions(); 20 | } 21 | 22 | protected override void OnStartup(StartupEventArgs e) 23 | { 24 | base.OnStartup(e); 25 | 26 | XamlDisplay.Init(); 27 | ThemeManager.Current.ChangeTheme("Light"); 28 | new GalleryBootstrapper().Run(); 29 | } 30 | 31 | private static void LoadAvalonEditEmbeddedXshdDefinitions() 32 | { 33 | var assembly = Assembly.GetExecutingAssembly(); 34 | var xshdFiles = assembly.GetManifestResourceNames().Where(file => file.EndsWith(".xshd")); 35 | 36 | foreach (var xshdFile in xshdFiles) 37 | { 38 | using (var stream = assembly.GetManifestResourceStream(xshdFile)) 39 | { 40 | if (stream == null) 41 | continue; 42 | 43 | using (var reader = new XmlTextReader(stream)) 44 | { 45 | var xshdDefinition = HighlightingLoader.Load(reader, HighlightingManager.Instance); 46 | HighlightingManager.Instance.RegisterHighlighting( 47 | xshdDefinition.Name, new string[] { }, xshdDefinition 48 | ); 49 | } 50 | } 51 | } 52 | } 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/ControlGallery/Assets/Images/Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuelroemer/Celestial.UIToolkit/933a0e7704bfe9ec5de5a35336489165393914c5/src/ControlGallery/Assets/Images/Landscape.png -------------------------------------------------------------------------------- /src/ControlGallery/Assets/Images/ThumbnailAbstract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuelroemer/Celestial.UIToolkit/933a0e7704bfe9ec5de5a35336489165393914c5/src/ControlGallery/Assets/Images/ThumbnailAbstract.png -------------------------------------------------------------------------------- /src/ControlGallery/Common/GalleryPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | 3 | namespace ControlGallery.Common 4 | { 5 | 6 | public abstract class GalleryPageViewModel : NavigationAwareViewModel 7 | { 8 | 9 | private string _title; 10 | public string Title 11 | { 12 | get => _title; 13 | set => SetProperty(ref _title, value); 14 | } 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/ControlGallery/Common/RegionNames.cs: -------------------------------------------------------------------------------- 1 | namespace ControlGallery.Common 2 | { 3 | 4 | public static class RegionNames 5 | { 6 | 7 | public const string Main = "Main"; 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/ControlGallery/Common/RegionNavigationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Practices.Unity; 2 | using Prism.Regions; 3 | using Prism.Unity; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ControlGallery.Common 11 | { 12 | 13 | 14 | /// 15 | /// Provides static methods for type-based region navigation using Prism. 16 | /// This follows the convention that every navigation target is registered under 17 | /// its type's full name. 18 | /// 19 | public static class RegionNavigationExtensions 20 | { 21 | 22 | public static void RequestNavigate( 23 | this IRegionManager regionManager, 24 | string regionName, 25 | NavigationParameters navigationParams = null) 26 | { 27 | regionManager.RequestNavigate(regionName, typeof(T), navigationParams); 28 | } 29 | 30 | public static void RequestNavigate( 31 | this IRegionManager regionManager, 32 | string regionName, 33 | Type targetType, 34 | NavigationParameters navigationParams = null) 35 | { 36 | regionManager.RequestNavigate(regionName, targetType.FullName, navigationParams); 37 | } 38 | 39 | public static void RequestNavigate( 40 | this IRegionNavigationService navigationService, 41 | NavigationParameters navigationParams = null) 42 | { 43 | navigationService.RequestNavigate(typeof(T), navigationParams); 44 | } 45 | 46 | public static void RequestNavigate( 47 | this IRegionNavigationService navigationService, 48 | Type targetType, 49 | NavigationParameters navigationParams = null) 50 | { 51 | navigationService.RequestNavigate(targetType.FullName, navigationParams); 52 | } 53 | 54 | public static void RegisterNavigationTarget(this IUnityContainer container) 55 | { 56 | container.RegisterTypeForNavigation(typeof(T).FullName); 57 | } 58 | 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/ControlGallery/ControlGallery.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | WinExe 7 | 8 | 9 | net46 10 | 11 | Properties 12 | 13 | true 14 | true 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/ControlGallery/Controls/XamlFormatterEx.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.Xml; 8 | using System.Xml.Linq; 9 | using Celestial.UIToolkit.Common; 10 | using ShowMeTheXAML; 11 | 12 | namespace ControlGallery.Controls 13 | { 14 | 15 | public class XamlFormatterEx : Singleton, IXamlFormatter 16 | { 17 | 18 | private XamlFormatterEx() { } 19 | 20 | public string FormatXaml(string xaml) 21 | { 22 | return PrettyXml(xaml); 23 | } 24 | 25 | static string PrettyXml(string xml) 26 | { 27 | var stringBuilder = new StringBuilder(); 28 | 29 | // Skip the XamlDisplayElement. 30 | var element = XElement.Parse(xml); 31 | element = element.Elements().First(); 32 | 33 | var settings = new XmlWriterSettings() 34 | { 35 | DoNotEscapeUriAttributes = true, 36 | Indent = true, 37 | IndentChars = " ", 38 | NewLineOnAttributes = true, 39 | OmitXmlDeclaration = true 40 | }; 41 | 42 | using (var xmlWriter = XmlWriter.Create(stringBuilder, settings)) 43 | { 44 | element.Save(xmlWriter); 45 | } 46 | 47 | return stringBuilder.ToString(); 48 | } 49 | 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/ControlGallery/Converters/StringToTextDocumentConverter.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Converters; 2 | using ICSharpCode.AvalonEdit.Document; 3 | using System.Globalization; 4 | 5 | namespace ControlGallery.Converters 6 | { 7 | 8 | public class StringToTextDocumentConverter : ValueConverter 9 | { 10 | 11 | public static StringToTextDocumentConverter Default { get; } 12 | = new StringToTextDocumentConverter(); 13 | 14 | public override TextDocument Convert(string value, object parameter, CultureInfo culture) 15 | { 16 | return new TextDocument(value ?? ""); 17 | } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/Categories/KnownCategories.Animations.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Xaml.SamplePages.Animations; 2 | using MahApps.Metro.IconPacks; 3 | 4 | namespace ControlGallery.Data.Categories 5 | { 6 | 7 | public static partial class KnownCategories 8 | { 9 | 10 | private static readonly ControlInformation BrushAnimationInfo = new ControlInformation() 11 | { 12 | Name = "BrushAnimation", 13 | Description = "The BrushAnimation works similar to WPF's ColorAnimation, but animates Brushes.", 14 | Icon = new PackIconModern() { Kind = PackIconModernKind.DrawBrush }, 15 | SamplePageType = typeof(BrushAnimation) 16 | }; 17 | 18 | public static ControlCategory Animations { get; } = new ControlCategory( 19 | "Animations", 20 | new PackIconModern() { Kind = PackIconModernKind.CursorMove }, 21 | BrushAnimationInfo); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/Categories/KnownCategories.Commanding.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Xaml.SamplePages.Commanding; 2 | using MahApps.Metro.IconPacks; 3 | 4 | namespace ControlGallery.Data.Categories 5 | { 6 | 7 | public static partial class KnownCategories 8 | { 9 | 10 | private static ControlInformation ButtonInfo = new ControlInformation() 11 | { 12 | Name = "Button", 13 | Description = "A Button is a control which responds to user input and has a Click event. " + 14 | "Buttons are typically used for invoking an action.", 15 | Icon = new PackIconMaterialLight() { Kind = PackIconMaterialLightKind.BorderAll }, 16 | SamplePageType = typeof(Button) 17 | }; 18 | 19 | public static ControlCategory Commanding { get; } = new ControlCategory( 20 | "Commanding", 21 | new PackIconMaterialLight() { Kind = PackIconMaterialLightKind.Message }, 22 | ButtonInfo); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/Categories/KnownCategories.Containers.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Data; 2 | using ControlGallery.Xaml.SamplePages.Containers; 3 | using MahApps.Metro.IconPacks; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ControlGallery.Data.Categories 12 | { 13 | 14 | public static partial class KnownCategories 15 | { 16 | 17 | private static ControlInformation CardInfo = new ControlInformation() 18 | { 19 | Name = "Card", 20 | Description = "A Card is a self-contained unit which displays content in an " + 21 | "organized form.", 22 | Icon = new PackIconModern() { Kind = PackIconModernKind.BorderOutside }, 23 | SamplePageType = typeof(Card), 24 | DocumentationLinks = new ObservableCollection() 25 | { 26 | new LinkViewModel("MD - Cards", "https://material.io/design/components/cards.html") 27 | } 28 | }; 29 | 30 | private static ControlInformation GroupBoxInfo = new ControlInformation() 31 | { 32 | Name = "GroupBox", 33 | Description = "A GroupBox is a container for elements which fall into a common category. It groups them together under a common Header.", 34 | Icon = new PackIconModern() { Kind = PackIconModernKind.BorderOutside }, 35 | SamplePageType = typeof(GroupBox), 36 | DocumentationLinks = new ObservableCollection() 37 | { 38 | new LinkViewModel("MSDN - GroupBox", "https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.groupbox?view=netframework-4.7.2") 39 | } 40 | }; 41 | 42 | public static ControlCategory Containers { get; } = new ControlCategory( 43 | "Containers", 44 | new PackIconModern() { Kind = PackIconModernKind.BorderOutside }, 45 | CardInfo, 46 | GroupBoxInfo); 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/Categories/KnownCategories.Indicators.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Xaml.SamplePages.Indicators; 2 | using MahApps.Metro.IconPacks; 3 | 4 | namespace ControlGallery.Data.Categories 5 | { 6 | 7 | public static partial class KnownCategories 8 | { 9 | 10 | private static ControlInformation ProgressBarInfo = new ControlInformation() 11 | { 12 | Name = "ProgressBar", 13 | Description = "A ProgressBar provides feedback to the user that a long running operation is underway.", 14 | Icon = new PackIconModern() { Kind = PackIconModernKind.Ring }, 15 | SamplePageType = typeof(ProgressBar) 16 | }; 17 | 18 | public static ControlCategory Indicators { get; } = new ControlCategory( 19 | "Indicators", 20 | new PackIconMaterialLight() { Kind = PackIconMaterialLightKind.BorderAll }, 21 | ProgressBarInfo); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/Categories/KnownCategories.Navigation.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Xaml.SamplePages.Navigation; 2 | using MahApps.Metro.IconPacks; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ControlGallery.Data.Categories 10 | { 11 | 12 | public static partial class KnownCategories 13 | { 14 | 15 | private static ControlInformation NavigationViewInfo = new ControlInformation() 16 | { 17 | Name = "NavigationView", 18 | Description = "A NavigationView consists of two content ares: A pane, which can be visible or not, " + 19 | "and an area which displays permanently visible content.", 20 | Icon = new PackIconModern() { Kind = PackIconModernKind.LinesHorizontal4 }, 21 | SamplePageType = typeof(NavigationView) 22 | }; 23 | 24 | private static ControlInformation TabControlInfo = new ControlInformation() 25 | { 26 | Name = "TabControl", 27 | Description = "A TabControl displays multiple pages of controls. A user can switch between them via Tabs.", 28 | Icon = new PackIconModern() { Kind = PackIconModernKind.Table }, 29 | SamplePageType = typeof(TabControl) 30 | }; 31 | 32 | private static ControlInformation WindowInfo = new ControlInformation() 33 | { 34 | Name = "Window", 35 | Description = "Windows are typically the root of your application and host its content..", 36 | Icon = new PackIconModern() { Kind = PackIconModernKind.Window }, 37 | SamplePageType = typeof(Window) 38 | }; 39 | 40 | public static ControlCategory Navigation { get; } = new ControlCategory( 41 | "Navigation", 42 | new PackIconModern() { Kind = PackIconModernKind.LinesHorizontal4 }, 43 | WindowInfo, 44 | NavigationViewInfo, 45 | TabControlInfo); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/ControlCategory.cs: -------------------------------------------------------------------------------- 1 | using Prism.Mvvm; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace ControlGallery.Data 6 | { 7 | 8 | /// 9 | /// Defines a category into which controls can be grouped. 10 | /// 11 | public class ControlCategory 12 | { 13 | 14 | public string Name { get; set; } 15 | 16 | public object Icon { get; set; } 17 | 18 | public ObservableCollection Controls { get; } 19 | 20 | public ControlCategory() 21 | : this(null) { } 22 | 23 | public ControlCategory(string name) 24 | : this(name, null) { } 25 | 26 | public ControlCategory(string name, object icon) 27 | : this(name, icon, (IEnumerable)null) { } 28 | 29 | public ControlCategory(string name, object icon, params ControlInformation[] controls) 30 | : this(name, icon, (IEnumerable)controls) { } 31 | 32 | public ControlCategory(string name, object icon, IEnumerable controls) 33 | { 34 | Name = name; 35 | Icon = icon; 36 | if (controls == null) 37 | { 38 | Controls = new ObservableCollection(); 39 | } 40 | else 41 | { 42 | Controls = new ObservableCollection(controls); 43 | } 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/ControlDataSource.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Data.Categories; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ControlGallery.Data 6 | { 7 | 8 | public interface IControlDataSource 9 | { 10 | IEnumerable GetCategories(); 11 | } 12 | 13 | public class ControlDataSource : IControlDataSource 14 | { 15 | 16 | public IEnumerable GetCategories() 17 | { 18 | yield return KnownCategories.Text; 19 | yield return KnownCategories.Commanding; 20 | yield return KnownCategories.Input; 21 | yield return KnownCategories.Indicators; 22 | yield return KnownCategories.Containers; 23 | yield return KnownCategories.Layout; 24 | yield return KnownCategories.Navigation; 25 | yield return KnownCategories.Animations; 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/ControlInformation.cs: -------------------------------------------------------------------------------- 1 | using Prism.Commands; 2 | using System; 3 | using System.Collections.ObjectModel; 4 | using System.Diagnostics; 5 | using System.Windows.Input; 6 | 7 | namespace ControlGallery.Data 8 | { 9 | 10 | /// 11 | /// Provides information about a specific type of control. 12 | /// This information is then displayed by the gallery application. 13 | /// 14 | public class ControlInformation 15 | { 16 | 17 | public string Name { get; set; } 18 | 19 | public string Description { get; set; } 20 | 21 | public object Icon { get; set; } 22 | 23 | public Type SamplePageType { get; set; } 24 | 25 | public ObservableCollection RelatedControls { get; set; } = 26 | new ObservableCollection(); 27 | 28 | public ObservableCollection DocumentationLinks { get; set; } = 29 | new ObservableCollection(); 30 | 31 | } 32 | 33 | public class LinkViewModel 34 | { 35 | 36 | public string Title { get; } 37 | 38 | public string UriString { get; } 39 | 40 | public ICommand OpenInBrowserCommand { get; } 41 | 42 | public LinkViewModel(string title, string uriString) 43 | { 44 | Title = title; 45 | UriString = uriString; 46 | 47 | OpenInBrowserCommand = new DelegateCommand(OpenInBrowser); 48 | } 49 | 50 | public void OpenInBrowser() 51 | { 52 | try 53 | { 54 | Process.Start(UriString); 55 | } 56 | catch { } // It doesn't really matter if this fails. No ex. handling required. 57 | } 58 | 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/FruitItems.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using System.Windows.Media; 3 | 4 | namespace ControlGallery.Data 5 | { 6 | 7 | // A very simple, static data source. 8 | 9 | public class Fruit 10 | { 11 | public string Name { get; set; } 12 | public Color Color { get; set; } 13 | 14 | public Fruit(string name, Color color) 15 | { 16 | Name = name; 17 | Color = color; 18 | } 19 | 20 | public override string ToString() => Name; 21 | } 22 | 23 | public static class FruitItems 24 | { 25 | 26 | public static ObservableCollection Fruits { get; } 27 | 28 | static FruitItems() 29 | { 30 | Fruits = new ObservableCollection() 31 | { 32 | new Fruit("Strawberry", Colors.DarkRed), 33 | new Fruit("Blueberry", Colors.DarkBlue), 34 | new Fruit("Pineapple", Colors.Yellow), 35 | new Fruit("Orange", Colors.Orange) 36 | }; 37 | } 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/LoremItems.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace ControlGallery.Data 5 | { 6 | 7 | /// 8 | /// Provides string item sources with a varying number of items. 9 | /// 10 | public static class LoremItems 11 | { 12 | 13 | private const string Lorem = "Lorem ipsum dolor sit amet consetetur sadipscing elitr sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat sed diam voluptua"; 14 | private static readonly string[] _loremWords = Lorem.Split(new char[] { ' ' }); 15 | 16 | public static ObservableCollection Lorem5 => 17 | new ObservableCollection(PickWords(5)); 18 | 19 | public static ObservableCollection Lorem10 => 20 | new ObservableCollection(PickWords(10)); 21 | 22 | public static ObservableCollection Lorem50 => 23 | new ObservableCollection(PickWords(50)); 24 | 25 | public static ObservableCollection Lorem100 => 26 | new ObservableCollection(PickWords(100)); 27 | 28 | public static ObservableCollection Lorem1000 => 29 | new ObservableCollection(PickWords(1000)); 30 | 31 | private static IEnumerable PickWords(int count) 32 | { 33 | if (count < 0) 34 | yield break; 35 | 36 | int loremWordsIndex = 0; 37 | for (int i = 0; i < count; i++) 38 | { 39 | if (loremWordsIndex == _loremWords.Length) 40 | loremWordsIndex = 0; 41 | 42 | yield return _loremWords[loremWordsIndex++]; 43 | } 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/ControlGallery/Data/README.txt: -------------------------------------------------------------------------------- 1 | To add a new Category: 2 | --------------------------------------- 3 | 4 | Add a "KnownCategories.[NAME].cs" file to the Categories folder. 5 | In there, implement the following template/structure: 6 | 7 | public static partial class KnownCategories 8 | { 9 | 10 | public static ControlCategory NAME { get; } = new ControlCategory( 11 | "NAME", 12 | new PackIconMaterialLight() { Kind = PackIconMaterialLightKind.ICON }, 13 | CONTROLS); 14 | 15 | } 16 | 17 | Then, head to ControlDataSource.cs and yield return the category in the GetCategories method. -------------------------------------------------------------------------------- /src/ControlGallery/Data/SampleCommands.cs: -------------------------------------------------------------------------------- 1 | using Prism.Commands; 2 | using System.Windows; 3 | using System.Windows.Input; 4 | 5 | namespace ControlGallery.Data 6 | { 7 | 8 | public static class SampleCommands 9 | { 10 | 11 | public static ICommand ShowMessageBox { get; } 12 | 13 | static SampleCommands() 14 | { 15 | ShowMessageBox = new DelegateCommand(ExecuteShowMessageBox); 16 | } 17 | 18 | private static void ExecuteShowMessageBox(string parameter) 19 | { 20 | string title = "Command Example"; 21 | string text = string.IsNullOrEmpty(parameter) ? "No command parameter was specified." 22 | : parameter; 23 | MessageBox.Show(text, title, MessageBoxButton.OK, MessageBoxImage.Information); 24 | } 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/GalleryBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Xaml; 2 | using Prism.Unity; 3 | using System.Windows; 4 | using Microsoft.Practices.Unity; 5 | using Prism.Mvvm; 6 | using System.Reflection; 7 | using System.Globalization; 8 | using System; 9 | using ControlGallery.Data; 10 | using ControlGallery.Common; 11 | using Prism.Regions; 12 | 13 | namespace ControlGallery 14 | { 15 | 16 | public class GalleryBootstrapper : UnityBootstrapper 17 | { 18 | 19 | protected override void ConfigureContainer() 20 | { 21 | base.ConfigureContainer(); 22 | 23 | Container.RegisterType( 24 | new ContainerControlledLifetimeManager()); 25 | 26 | Container.RegisterNavigationTarget(); 27 | Container.RegisterNavigationTarget(); 28 | Container.RegisterNavigationTarget(); 29 | } 30 | 31 | protected override DependencyObject CreateShell() 32 | { 33 | return Container.Resolve(); 34 | } 35 | 36 | protected override void InitializeShell() 37 | { 38 | Container.Resolve() 39 | .RequestNavigate(RegionNames.Main); 40 | Application.Current.MainWindow.Show(); 41 | } 42 | 43 | protected override void ConfigureViewModelLocator() 44 | { 45 | ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver(viewType => 46 | { 47 | var viewName = viewType.FullName; 48 | var viewAssemblyName = viewType.GetTypeInfo().Assembly.FullName; 49 | var suffix = viewName.EndsWith("View") ? "Model" : "ViewModel"; 50 | var viewModelName = string.Format( 51 | CultureInfo.InvariantCulture, 52 | "{0}{1}, {2}", 53 | viewName, suffix, viewAssemblyName); 54 | return Type.GetType(viewModelName); 55 | }); 56 | 57 | ViewModelLocationProvider.SetDefaultViewModelFactory(type => 58 | Container.Resolve(type)); 59 | } 60 | 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/ControlGallery/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // Setting ComVisible to false makes the types in this assembly not visible 8 | // to COM components. If you need to access a type in this assembly from 9 | // COM, set the ComVisible attribute to true on that type. 10 | [assembly: ComVisible(false)] 11 | 12 | //In order to begin building localizable applications, set 13 | //CultureYouAreCodingWith in your .csproj file 14 | //inside a . For example, if you are using US english 15 | //in your source files, set the to en-US. Then uncomment 16 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 17 | //the line below to match the UICulture setting in the project file. 18 | 19 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 20 | 21 | 22 | [assembly: ThemeInfo( 23 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 24 | //(used if a resource is not found in the page, 25 | // or application resource dictionaries) 26 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 27 | //(used if a resource is not found in the page, 28 | // app, or any theme specific resource dictionaries) 29 | )] 30 | -------------------------------------------------------------------------------- /src/ControlGallery/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ControlGallery.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ControlGallery/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/ControlGallery/Themes/AvalonEdit.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/ControlGallery/Themes/XamlDisplay.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 15 | 41 | 42 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/CategoryPage.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 ControlGallery.Xaml 17 | { 18 | /// 19 | /// Interaction logic for CategoryPage.xaml 20 | /// 21 | public partial class CategoryPage : UserControl 22 | { 23 | public CategoryPage() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/CategoryPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using ControlGallery.Common; 2 | using ControlGallery.Data; 3 | using Prism.Regions; 4 | 5 | namespace ControlGallery.Xaml 6 | { 7 | 8 | public class CategoryPageViewModel : GalleryPageViewModel 9 | { 10 | 11 | public const string CategoryParameterName = "Category"; 12 | 13 | private ControlCategory _category; 14 | public ControlCategory Category 15 | { 16 | get { return _category; } 17 | set 18 | { 19 | SetProperty(ref _category, value); 20 | Title = value?.Name; 21 | } 22 | } 23 | 24 | private ControlInformation _selectedControl; 25 | public ControlInformation SelectedControl 26 | { 27 | get { return _selectedControl; } 28 | set 29 | { 30 | SetProperty(ref _selectedControl, value); 31 | NavigateToSelectedControl(); 32 | } 33 | } 34 | 35 | public override void OnNavigatedTo(NavigationContext ctx) 36 | { 37 | base.OnNavigatedTo(ctx); 38 | 39 | var category = ctx.Parameters[CategoryParameterName] as ControlCategory; 40 | Category = category; 41 | } 42 | 43 | private void NavigateToSelectedControl() 44 | { 45 | if (SelectedControl != null) 46 | { 47 | var navigationParams = new NavigationParameters(); 48 | navigationParams.Add( 49 | ControlPageViewModel.ControlInformationParameterName, 50 | SelectedControl); 51 | 52 | NavigationService.RequestNavigate( 53 | typeof(ControlPage), 54 | navigationParams); 55 | 56 | // Reset the selection, since we navigated away. 57 | // This is required, because the ListView couldn't be "Clicked" otherwise. 58 | SelectedControl = null; 59 | } 60 | } 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/ControlPage.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 ControlGallery.Xaml 17 | { 18 | /// 19 | /// Interaction logic for ControlPage.xaml 20 | /// 21 | public partial class ControlPage : UserControl 22 | { 23 | public ControlPage() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/ControlPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using ControlGallery.Common; 4 | using ControlGallery.Data; 5 | using Prism.Regions; 6 | 7 | namespace ControlGallery.Xaml 8 | { 9 | 10 | public class ControlPageViewModel : GalleryPageViewModel 11 | { 12 | 13 | public const string ControlInformationParameterName = "ControlInformation"; 14 | 15 | private ControlInformation _controlInformation; 16 | public ControlInformation ControlInformation 17 | { 18 | get { return _controlInformation; } 19 | set 20 | { 21 | SetProperty(ref _controlInformation, value); 22 | Title = value?.Name; 23 | } 24 | } 25 | 26 | private object _samplePageContent; 27 | public object SamplePageContent 28 | { 29 | get { return _samplePageContent; } 30 | set { SetProperty(ref _samplePageContent, value); } 31 | } 32 | 33 | public override void OnNavigatedTo(NavigationContext ctx) 34 | { 35 | base.OnNavigatedTo(ctx); 36 | 37 | ControlInformation = ctx.Parameters[ControlInformationParameterName] as ControlInformation; 38 | CreateSamplePageContent(); 39 | } 40 | 41 | private void CreateSamplePageContent() 42 | { 43 | // The ControlInfo only defines a type for the SamplePage. 44 | // We want a content, so try to instanciate it. 45 | if (ControlInformation != null && ControlInformation.SamplePageType != null) 46 | { 47 | try 48 | { 49 | SamplePageContent = Activator.CreateInstance(ControlInformation.SamplePageType); 50 | } 51 | catch (Exception ex) 52 | { 53 | Trace.TraceError( 54 | $"Failed to create a sample page instance. " + 55 | $"ControlInfo: {0}, Ex: {1}", 56 | ControlInformation.Name, 57 | ex.ToString()); 58 | } 59 | } 60 | else 61 | { 62 | SamplePageContent = null; 63 | } 64 | } 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/HomePage.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/HomePage.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 ControlGallery.Xaml 17 | { 18 | /// 19 | /// Interaction logic for HomePage.xaml 20 | /// 21 | public partial class HomePage : UserControl 22 | { 23 | public HomePage() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/HomePageViewModel.cs: -------------------------------------------------------------------------------- 1 | using Celestial.UIToolkit.Xaml; 2 | using ControlGallery.Common; 3 | using Prism.Commands; 4 | using Prism.Regions; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ControlGallery.Xaml 12 | { 13 | 14 | public sealed class HomePageViewModel : GalleryPageViewModel 15 | { 16 | 17 | public HomePageViewModel() 18 | { 19 | Title = "Home"; 20 | } 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace ControlGallery.Xaml 4 | { 5 | 6 | public partial class MainWindow : Window 7 | { 8 | 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Animations/BrushAnimation.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 ControlGallery.Xaml.SamplePages.Animations 17 | { 18 | /// 19 | /// Interaction logic for BrushAnimation.xaml 20 | /// 21 | public partial class BrushAnimation : UserControl 22 | { 23 | public BrushAnimation() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Commanding/Button.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 ControlGallery.Xaml.SamplePages.Commanding 17 | { 18 | /// 19 | /// Interaction logic for Button.xaml 20 | /// 21 | public partial class Button : UserControl 22 | { 23 | public Button() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Containers/Card.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 18 | 19 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Hello from the Card's default content! 32 | 33 | 34 | 35 | 36 | 37 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Containers/Card.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 ControlGallery.Xaml.SamplePages.Containers 17 | { 18 | /// 19 | /// Interaction logic for Card.xaml 20 | /// 21 | public partial class Card : UserControl 22 | { 23 | public Card() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Containers/GroupBox.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 ControlGallery.Xaml.SamplePages.Containers 17 | { 18 | /// 19 | /// Interaction logic for GroupBox.xaml 20 | /// 21 | public partial class GroupBox : UserControl 22 | { 23 | public GroupBox() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Indicators/ProgressBar.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 ControlGallery.Xaml.SamplePages.Indicators 17 | { 18 | /// 19 | /// Interaction logic for ProgressBar.xaml 20 | /// 21 | public partial class ProgressBar : UserControl 22 | { 23 | public ProgressBar() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/CheckBox.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for CheckBox.xaml 20 | /// 21 | public partial class CheckBox : UserControl 22 | { 23 | public CheckBox() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/ComboBox.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for ComboBox.xaml 20 | /// 21 | public partial class ComboBox : UserControl 22 | { 23 | public ComboBox() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/ListBox.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for ListBox.xaml 20 | /// 21 | public partial class ListBox : UserControl 22 | { 23 | public ListBox() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/ListView.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for ListView.xaml 20 | /// 21 | public partial class ListView : UserControl 22 | { 23 | public ListView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/PasswordBox.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for PasswordBox.xaml 20 | /// 21 | public partial class PasswordBox : UserControl 22 | { 23 | public PasswordBox() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/RadioButton.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for RadioButton.xaml 20 | /// 21 | public partial class RadioButton : UserControl 22 | { 23 | public RadioButton() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/Slider.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for Slider.xaml 20 | /// 21 | public partial class Slider : UserControl 22 | { 23 | public Slider() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/TextBox.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for TextBox.xaml 20 | /// 21 | public partial class TextBox : UserControl 22 | { 23 | public TextBox() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/ToggleSwitch.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for ToggleSwitch.xaml 20 | /// 21 | public partial class ToggleSwitch : UserControl 22 | { 23 | public ToggleSwitch() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Input/TreeView.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 ControlGallery.Xaml.SamplePages.Input 17 | { 18 | /// 19 | /// Interaction logic for TreeView.xaml 20 | /// 21 | public partial class TreeView : UserControl 22 | { 23 | public TreeView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Layout/Expander.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 ControlGallery.Xaml.SamplePages.Layout 17 | { 18 | /// 19 | /// Interaction logic for Expander.xaml 20 | /// 21 | public partial class Expander : UserControl 22 | { 23 | public Expander() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Layout/Menu.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 ControlGallery.Xaml.SamplePages.Layout 17 | { 18 | /// 19 | /// Interaction logic for Menu.xaml 20 | /// 21 | public partial class Menu : UserControl 22 | { 23 | public Menu() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Layout/RelativeCanvas.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 ControlGallery.Xaml.SamplePages.Layout 17 | { 18 | /// 19 | /// Interaction logic for RelativeCanvas.xaml 20 | /// 21 | public partial class RelativeCanvas : UserControl 22 | { 23 | public RelativeCanvas() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Layout/ScrollViewer.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 ControlGallery.Xaml.SamplePages.Layout 17 | { 18 | /// 19 | /// Interaction logic for ScrollViewer.xaml 20 | /// 21 | public partial class ScrollViewer : UserControl 22 | { 23 | public ScrollViewer() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Layout/SplitView.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 ControlGallery.Xaml.SamplePages.Layout 17 | { 18 | /// 19 | /// Interaction logic for SplitView.xaml 20 | /// 21 | public partial class SplitView : UserControl 22 | { 23 | public SplitView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Layout/StatusBar.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 ControlGallery.Xaml.SamplePages.Layout 17 | { 18 | /// 19 | /// Interaction logic for StatusBar.xaml 20 | /// 21 | public partial class StatusBar : UserControl 22 | { 23 | public StatusBar() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Layout/ToolBar.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 ControlGallery.Xaml.SamplePages.Layout 17 | { 18 | /// 19 | /// Interaction logic for ToolBar.xaml 20 | /// 21 | public partial class ToolBar : UserControl 22 | { 23 | public ToolBar() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Navigation/NavigationView.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 ControlGallery.Xaml.SamplePages.Navigation 17 | { 18 | /// 19 | /// Interaction logic for NavigationView.xaml 20 | /// 21 | public partial class NavigationView : UserControl 22 | { 23 | public NavigationView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Navigation/TabControl.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 ControlGallery.Xaml.SamplePages.Navigation 17 | { 18 | /// 19 | /// Interaction logic for TabControl.xaml 20 | /// 21 | public partial class TabControl : UserControl 22 | { 23 | public TabControl() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Navigation/Window.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 ControlGallery.Xaml.SamplePages.Navigation 17 | { 18 | /// 19 | /// Interaction logic for Window.xaml 20 | /// 21 | public partial class Window : UserControl 22 | { 23 | public Window() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Text/Label.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 18 | 19 | 21 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Text/Label.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 ControlGallery.Xaml.SamplePages.Text 17 | { 18 | /// 19 | /// Interaction logic for Label.xaml 20 | /// 21 | public partial class Label : UserControl 22 | { 23 | public Label() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Text/TextBlock.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 ControlGallery.Xaml.SamplePages.Text 17 | { 18 | /// 19 | /// Interaction logic for TextBlock.xaml 20 | /// 21 | public partial class TextBlock : UserControl 22 | { 23 | public TextBlock() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ControlGallery/Xaml/SamplePages/Text/ToolTip.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 18 | 19 | 21 |