├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── documentation.md │ ├── feature_request.md │ └── support_request.md ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── ThirdPartyNotices.txt ├── azure-pipelines.yml ├── docs ├── Gemfile ├── Gemfile.lock ├── _config.yml ├── _data │ ├── features.yaml │ └── nav.yaml ├── _expo │ ├── codeidx.md │ ├── dawn.md │ ├── divinity-mod-manager.md │ ├── image-sort.md │ ├── stein.md │ ├── vnManager.md │ └── zen-timings.md ├── _includes │ ├── button.html │ ├── cross-divider.html │ ├── feature-cards.html │ ├── head_custom.html │ ├── nav-docs.html │ ├── nav-expo.html │ └── nav.html ├── _layouts │ ├── default.html │ ├── expo.html │ └── title.html ├── _sass │ ├── code.scss │ ├── custom │ │ ├── cross-divider.scss │ │ ├── custom.scss │ │ ├── expo.scss │ │ ├── feature-cards.scss │ │ └── icons.scss │ └── overrides.scss ├── assets │ └── js │ │ ├── custom.js │ │ └── search-data.json ├── docs │ ├── getting-started │ │ ├── configuration.md │ │ ├── index.md │ │ └── introduction.md │ └── guides │ │ ├── colors-and-brushes.md │ │ ├── cursor-spotlight.md │ │ ├── custom-controls.md │ │ ├── data-validation.md │ │ ├── dimensions.md │ │ ├── index.md │ │ ├── layers.md │ │ ├── loading.md │ │ ├── message-box.md │ │ ├── ripple.md │ │ ├── scrollbars.md │ │ ├── space.md │ │ ├── styles-and-templates.md │ │ ├── watermark.md │ │ └── window.md ├── expo │ └── index.md ├── favicon.ico ├── img │ ├── adonis-demo-cursor-spotlight-dark.gif │ ├── adonis-demo-cursor-spotlight-light.gif │ ├── adonis-demo-layer-on-dark.png │ ├── adonis-demo-layer-on-light.png │ ├── adonis-demo-loadingbars-light.gif │ ├── adonis-demo-loadingcircle-light.gif │ ├── adonis-demo-loadingdots-light.gif │ ├── adonis-demo-messagebox-advanced-light.png │ ├── adonis-demo-messagebox-dark.png │ ├── adonis-demo-messagebox-light.png │ ├── adonis-demo-peak-dark.gif │ ├── adonis-demo-peak-light.gif │ ├── adonis-demo-progressbar-content-light.png │ ├── adonis-demo-progressbar-contenttemplate-light.png │ ├── adonis-demo-progressbar-light.gif │ ├── adonis-demo-ripple-dark.gif │ ├── adonis-demo-ripple-light.gif │ ├── adonis-demo-scrollbar-light.gif │ ├── adonis-demo-scrollbar-placement-light.png │ ├── adonis-demo-splitbutton-collapsed-light.png │ ├── adonis-demo-splitbutton-expanded-light.png │ ├── adonis-demo-switch-color-schemes.gif │ ├── adonis-demo-validation-dark.png │ ├── adonis-demo-validation-light.png │ ├── adonis-demo-watermark-light.png │ ├── adonis-titlebar-gradient.png │ ├── adonis-titlebar-green.png │ ├── adonis-titlebar-place-over-false.png │ ├── adonis-titlebar-place-over-true.png │ ├── adonis-titlebar-red.png │ ├── adonis-titlebar-yellow.png │ ├── codeidx-light.png │ ├── dawn-dark.png │ ├── divinity-mod-manager-dark.png │ ├── divinity-mod-manager-light.png │ ├── image-sort-dark.gif │ ├── logo-horizontal.svg │ ├── stein-dark.png │ ├── stein-light.png │ ├── vnManager-dark.png │ ├── zen-timings-dark.png │ └── zen-timings-light.png └── index.md ├── global.json ├── resources ├── adonis-favicon.afdesign ├── adonis-github-social-preview.afdesign ├── adonis-icons.afdesign ├── adonis-logo.afdesign └── img │ ├── favicon-256x256.png │ ├── favicon-32x32.png │ ├── favicon.svg │ └── github-social-preview.png ├── scripts └── NuGetPack.ps1 └── src ├── AdonisUI.ClassicTheme ├── AdonisUI.ClassicTheme.csproj ├── DefaultStyles │ ├── Button.xaml │ ├── Calendar.xaml │ ├── CheckBox.xaml │ ├── ComboBox.xaml │ ├── DataGrid.xaml │ ├── DatePicker.xaml │ ├── Expander.xaml │ ├── GridSplitter.xaml │ ├── GroupBox.xaml │ ├── Hyperlink.xaml │ ├── Label.xaml │ ├── ListBox.xaml │ ├── ListView.xaml │ ├── Menu.xaml │ ├── MenuItem.xaml │ ├── MessageBoxWindow.xaml │ ├── ProgressBar.xaml │ ├── RadioButton.xaml │ ├── ScrollBar.xaml │ ├── ScrollViewer.xaml │ ├── Slider.xaml │ ├── SplitButton.xaml │ ├── StatusBar.xaml │ ├── TabControl.xaml │ ├── TextBlock.xaml │ ├── TextBox.xaml │ ├── ToggleButton.xaml │ ├── ToolBar.xaml │ ├── TreeView.xaml │ └── Window.xaml ├── Dimensions.xaml ├── NamedStyles │ ├── AccentButton.xaml │ ├── AccentComboBox.xaml │ ├── AccentToolbarButton.xaml │ ├── DefaultToAccentToggleButton.xaml │ ├── RippleListBoxItemStyle.xaml │ ├── SelectableTextBlockTextBox.xaml │ ├── ToggleSwitch.xaml │ ├── ToolbarButton.xaml │ ├── ToolbarToggleButton.xaml │ ├── WindowButton.xaml │ └── WindowToggleButton.xaml ├── Resources.xaml ├── Templates │ ├── DatePickerDropDownButton.xaml │ ├── Expander.xaml │ ├── Icons.xaml │ ├── LoadingBars.xaml │ ├── LoadingCircle.xaml │ ├── LoadingDots.xaml │ └── ValidationErrorTemplate.xaml └── Themes │ └── Themes.cs ├── AdonisUI.Demo ├── AdonisUI.Demo.csproj ├── App.config ├── App.ico ├── App.manifest ├── App.xaml ├── App.xaml.cs ├── Behaviors │ └── HyperlinkExtension.cs ├── Commands │ ├── CollectionSampleAddItemCommand.cs │ └── MessageBoxSampleShowMessageBoxCommand.cs ├── Converters │ ├── BoolToInverseBoolConverter.cs │ ├── ColorToHexStringConverter.cs │ └── FormatCamelCaseConverter.cs ├── Framework │ ├── Command.cs │ ├── ViewModel.cs │ └── ViewModelCommand.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── MarkupExtensions │ └── ResourceBinding.cs ├── Services │ ├── IItemGenerator.cs │ └── ItemGenerator.cs ├── Styles │ ├── ControlReferenceSectionStyle.xaml │ └── ItemGroupLabelStyle.xaml ├── Themes │ └── Themes.cs ├── ViewModels │ ├── ApplicationNavigationGroup.cs │ ├── ApplicationViewModel.cs │ ├── BrushResourceViewModel.cs │ ├── ButtonReferenceViewModel.cs │ ├── CollectionSampleViewModel.cs │ ├── ColorReferenceViewModel.cs │ ├── IApplicationContentView.cs │ ├── Issue101ScenarioViewModel.cs │ ├── Issue23ScenarioViewModel.cs │ ├── Issue26ScenarioViewModel.cs │ ├── Issue5ScenarioViewModel.cs │ ├── IssueDialogViewModel.cs │ ├── IssueRippleContentInvisibleScenarioViewModel.cs │ ├── ItemViewModel.cs │ ├── LayerSampleViewModel.cs │ ├── LayerSimpleSampleViewModel.cs │ ├── ListBoxReferenceViewModel.cs │ ├── LoadingReferenceViewModel.cs │ ├── MessageBoxReferenceViewModel.cs │ ├── OverviewSampleViewModel.cs │ ├── ScrollBarReferenceViewModel.cs │ ├── TextInputReferenceViewModel.cs │ ├── ToggleReferenceViewModel.cs │ ├── ToolBarReferenceViewModel.cs │ └── ValidationSampleViewModel.cs ├── Views.xaml └── Views │ ├── ButtonReference.xaml │ ├── CollectionSample.xaml │ ├── ColorReference.xaml │ ├── ControlBrushesBreakdown.xaml │ ├── ControlBrushesBreakdown.xaml.cs │ ├── ControlReferenceControl.xaml │ ├── ControlReferenceControl.xaml.cs │ ├── Issue101Scenario.xaml │ ├── Issue23Scenario.xaml │ ├── Issue26Scenario.xaml │ ├── Issue5Scenario.xaml │ ├── IssueRippleContentInvisibleScenario.xaml │ ├── IssueScenarioControl.xaml │ ├── IssueScenarioControl.xaml.cs │ ├── LayerSample.xaml │ ├── LayerSimpleSample.xaml │ ├── ListBoxReference.xaml │ ├── LoadingReference.xaml │ ├── MessageBoxReference.xaml │ ├── OverviewSample.xaml │ ├── ScrollBarReference.xaml │ ├── ScrollBarReference.xaml.cs │ ├── TextInputReference.xaml │ ├── ToggleReference.xaml │ ├── ToolBarReference.xaml │ └── ValidationSample.xaml ├── AdonisUI.sln └── AdonisUI ├── AdonisUI.csproj ├── Brushes.cs ├── ColorSchemes ├── Dark.xaml └── Light.xaml ├── Colors.cs ├── Controls ├── AdonisWindow.cs ├── AdonisWindow.xaml ├── AdornedControl.cs ├── AdornerPlacement.cs ├── FrameworkElementAdorner.cs ├── IMessageBoxButtonModel.cs ├── IMessageBoxCheckBoxModel.cs ├── IMessageBoxModel.cs ├── MessageBox.cs ├── MessageBoxButton.cs ├── MessageBoxButtonModel.cs ├── MessageBoxButtons.cs ├── MessageBoxCheckBoxModel.cs ├── MessageBoxCheckBoxPlacement.cs ├── MessageBoxImage.cs ├── MessageBoxModel.cs ├── MessageBoxResult.cs ├── MessageBoxWindow.cs ├── MessageBoxWindow.xaml ├── RippleHost.cs ├── RippleHost.xaml ├── SortGlyphAdorner.cs ├── SplitButton.cs ├── SplitButton.xaml ├── ValidationErrorIndicator.cs ├── ValidationErrorIndicator.xaml └── ValidationErrorIndicatorPlacement.cs ├── Converters ├── AllBoolsToBoolConverter.cs ├── AllVisibilitiesToVisibilityConverter.cs ├── EqualitityToVisibilityConverter.cs ├── EqualityToBoolConverter.cs ├── IconToBitmapSourceConverter.cs ├── IsImmutableFilterConverter.cs ├── IsImmutableToBoolConverter.cs ├── IsNullToBoolConverter.cs ├── MathConverter.cs ├── RectConverter.cs ├── StringIsNullOrEmptyToBoolConverter.cs ├── StringIsNullOrEmptyToVisibilityConverter.cs ├── ThicknessToInverseThicknessConverter.cs ├── ValuesToCornerRadiusConverter.cs ├── ValuesToThicknessConverter.cs └── VisibilityToInverseVisibilityConverter.cs ├── Dimensions.cs ├── Extensions ├── CornerRadiusExtension.cs ├── CursorSpotlightExtension.cs ├── DataGridExtension.cs ├── GridViewSortExtension.cs ├── GroupBoxExtension.cs ├── LayerExtension.cs ├── MenuItemExtension.cs ├── ProgressBarExtension.cs ├── RippleExtension.cs ├── ScrollBarExpansionMode.cs ├── ScrollBarExtension.cs ├── ScrollBarPlacement.cs ├── ScrollViewerExtension.cs ├── TreeViewItemMouseOverExtension.cs ├── ValidationExtension.cs └── WatermarkExtension.cs ├── Helpers ├── HwndInterop.cs ├── HwndInteropPositionChangingEventArgs.cs ├── HwndInteropSizeChangedEventArgs.cs ├── ResourceAliasExtension.cs ├── ScreenInterop.cs ├── SystemContextMenuInterop.cs └── UINavigator.cs ├── Icons.cs ├── ResourceLocator.cs ├── SpaceExtension.cs ├── Styles.cs ├── Templates.cs ├── Themes ├── Generic.xaml └── Themes.cs └── ViewModels └── PropertyChangedBase.cs /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: 'bug' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation 3 | about: Suggest an improvement for the documentation of this project 4 | title: '' 5 | labels: 'enhancement' 6 | assignees: '' 7 | 8 | --- 9 | 10 | I feel like the docs are missing a section about ... 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: 'enhancement' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support request 3 | about: Question on how to use this project 4 | title: '' 5 | labels: 'question' 6 | assignees: '' 7 | 8 | --- 9 | 10 | I have a question regarding ... 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Adonis UI 2 | We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: 3 | 4 | - Reporting a bug 5 | - Discussing the current state of the code 6 | - Submitting a fix 7 | - Proposing new features 8 | - Becoming a maintainer 9 | 10 | ## We develop with Github 11 | We use github to host code, to track issues and feature requests, as well as accept pull requests. 12 | 13 | ## We use [Github Flow](https://guides.github.com/introduction/flow/index.html), so all code changes happen through pull requests 14 | Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests: 15 | 16 | 1. Fork the repo and create your branch from `master`. 17 | 2. If you've added or changed features, update the documentation. 18 | 3. Ensure your changes run on all target frameworks. 19 | 4. Issue that pull request! 20 | 21 | ## Any contributions you make will be under the MIT Software License 22 | In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. 23 | 24 | ## Report bugs using Github's [issues](https://github.com/benruehl/adonis-ui/issues) 25 | We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/benruehl/adonis-ui/issues/new/choose). You will be asked to choose from different templates. Each template will give you guidance to create a meaningful issue. It's that easy! 26 | 27 | ## Use a consistent coding style 28 | Please be consistent with the project's coding style. It makes maintaining easier and helps other developers understand the code. The project follows the default styling rules of Visual Studio and ReSharper. 29 | 30 | ## Use a consistent commit message style 31 | 32 | Please adapt to the project's commit message style to keep browsing the history enjoyable. We use [Tim Pope's commit message format](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 33 | 34 | In short: 35 | 36 | - Separate subject from body with a blank line 37 | - Capitalize the subject line 38 | - Do not end the subject line with a period 39 | - Use the imperative mood in the subject line 40 | - Use the body to explain what and why vs. how 41 | 42 | Please have a look at [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) by Chris Beams for an in-depth explanation with examples. 43 | 44 | ## License 45 | By contributing, you agree that your contributions will be licensed under its MIT License. 46 | 47 | ## References 48 | This document was adapted from the [open-source contribution guidelines template by @briandk](https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62). 49 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Benjamin Rühl 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 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # .NET Desktop 2 | # Build and run tests for .NET Desktop or Windows classic desktop solutions. 3 | # Add steps that publish symbols, save build artifacts, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net 5 | 6 | pool: 7 | vmImage: 'windows-2019' 8 | 9 | variables: 10 | solution: '**/*.sln' 11 | buildPlatform: 'Any CPU' 12 | buildConfiguration: 'Release' 13 | 14 | steps: 15 | - task: UseDotNet@2 16 | displayName: 'Install .NET' 17 | inputs: 18 | packageType: 'sdk' 19 | useGlobalJson: true 20 | 21 | - task: NuGetToolInstaller@1 22 | displayName: 'Install NuGet' 23 | 24 | - task: NuGetCommand@2 25 | displayName: 'Restore packages' 26 | inputs: 27 | restoreSolution: '$(solution)' 28 | 29 | - task: VSBuild@1 30 | displayName: 'Build solution' 31 | inputs: 32 | solution: '$(solution)' 33 | platform: '$(buildPlatform)' 34 | configuration: '$(buildConfiguration)' 35 | 36 | - task: DotNetCoreCLI@2 37 | displayName: 'Pack NuGet packages' 38 | inputs: 39 | command: 'pack' 40 | packagesToPack: '**/AdonisUI.csproj;**/AdonisUI.ClassicTheme.csproj' 41 | versioningScheme: 'off' 42 | configuration: '$(buildConfiguration)' 43 | packDestination: '$(Build.ArtifactStagingDirectory)' 44 | 45 | - task: PublishBuildArtifacts@1 46 | displayName: 'Publish build artifacts' 47 | inputs: 48 | pathToPublish: '$(Build.ArtifactStagingDirectory)' 49 | artifactName: drop 50 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'github-pages', group: :jekyll_plugins 3 | gem 'just-the-docs', '0.2.8' 4 | gem 'jekyll-redirect-from' 5 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | title: Adonis UI 2 | description: >- # this means to ignore newlines until next key 3 | Lightweight UI toolkit for WPF applications offering classic but enhanced windows visuals 4 | 5 | github_username: benruehl 6 | remote_theme: pmarsceill/just-the-docs@v0.2.8 7 | theme: "just-the-docs" 8 | baseurl: /adonis-ui 9 | 10 | repository: benruehl/adonis-ui 11 | nuget_url: https://www.nuget.org/packages/AdonisUI.ClassicTheme/ 12 | 13 | permalink: pretty 14 | exclude: ["Gemfile", "Gemfile.lock"] 15 | 16 | # Set a path/url to a logo that will be displayed instead of the title 17 | logo: "/img/logo-horizontal.svg" 18 | 19 | # Enable or disable the site search 20 | search_enabled: true 21 | 22 | # Set the search token separator for hyphenated-word search: 23 | search_tokenizer_separator: /[\s/]+/ 24 | 25 | # Enable or disable heading anchors 26 | heading_anchors: true 27 | 28 | # Aux links for the upper right navigation 29 | aux_links: 30 | "Adonis UI on GitHub": 31 | - "//github.com/benruehl/adonis-ui" 32 | 33 | # Footer content appears at the bottom of every page's main content 34 | footer_content: "Copyright © 2018-2020 Benjamin Rühl. Distributed by an MIT license." 35 | 36 | # Color scheme currently only supports "dark" or nil (default) 37 | color_scheme: nil 38 | 39 | compress_html: 40 | clippings: all 41 | comments: all 42 | endings: all 43 | startings: [] 44 | blanklines: false 45 | profile: false 46 | 47 | plugins: 48 | - jekyll-redirect-from 49 | 50 | collections: 51 | expo: 52 | output: true 53 | -------------------------------------------------------------------------------- /docs/_data/features.yaml: -------------------------------------------------------------------------------- 1 | items: 2 | - title: Enhanced default WPF controls 3 | items: 4 | - title: 30+ styles 5 | - title: Light and dark color scheme 6 | - title: Cursor Spotlight hover effect 7 | url: /adonis-ui/docs/guides/cursor-spotlight 8 | - title: Ripple effect 9 | url: /adonis-ui/docs/guides/ripple 10 | - title: Data validation support 11 | url: /adonis-ui/docs/guides/data-validation 12 | - title: Convenient UI development 13 | items: 14 | - title: Reusable and configurable colors 15 | url: /adonis-ui/docs/guides/colors-and-brushes 16 | - title: Customizable window title bar 17 | url: /adonis-ui/docs/guides/window 18 | - title: Layering system 19 | url: /adonis-ui/docs/guides/layers 20 | - title: Space system 21 | url: /adonis-ui/docs/guides/space 22 | -------------------------------------------------------------------------------- /docs/_data/nav.yaml: -------------------------------------------------------------------------------- 1 | items: 2 | - title: Home 3 | url: / 4 | - title: Docs 5 | url: /docs/getting-started/introduction 6 | - title: Expo 7 | url: /expo 8 | -------------------------------------------------------------------------------- /docs/_expo/codeidx.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: CodeIDX 3 | author: Erik Kuhlig 4 | tagline: CodeIDX indexes source code using Lucene. It exposes a UI for searching the text of indexed files. 5 | project_url: https://github.com/benruehl/codeidx 6 | date_visited: 20.01.2020 7 | order: 200 8 | --- 9 | 10 | ![CodeIDX with light color scheme](../img/codeidx-light.png) 11 | -------------------------------------------------------------------------------- /docs/_expo/dawn.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Dawn 3 | author: Peter Vietense 4 | tagline: "A utility to quickly update a directories contents while automatically backing up all the new files and making them available as past updates/backups." 5 | project_url: https://github.com/Insire/Dawn 6 | date_visited: 28.12.2020 7 | order: 600 8 | --- 9 | 10 | ![Dawn with dark color scheme](../img/dawn-dark.png) 11 | -------------------------------------------------------------------------------- /docs/_expo/divinity-mod-manager.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: LaughingLeader's Divinity Mod Manager 3 | author: LaughingLeader 4 | tagline: "A work-in-progress mod manager for Divinity: Original Sin 2 - Definitive Edition." 5 | project_url: https://github.com/LaughingLeader-DOS2-Mods/DivinityModManager 6 | date_visited: 28.01.2020 7 | order: 300 8 | --- 9 | 10 | ![Divinity Mod Manager with light color scheme](../img/divinity-mod-manager-light.png) 11 | ![Divinity Mod Manager with dark color scheme](../img/divinity-mod-manager-dark.png) 12 | -------------------------------------------------------------------------------- /docs/_expo/image-sort.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Image Sort 3 | author: Lolle2000la 4 | tagline: Sorts your image at high speed 5 | project_url: https://github.com/Lolle2000la/Image-Sort 6 | date_visited: 22.03.2020 7 | order: 400 8 | --- 9 | 10 | ![Image Sort](../img/image-sort-dark.gif) 11 | -------------------------------------------------------------------------------- /docs/_expo/stein.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Stein 3 | author: Niclas Kristek 4 | tagline: Stein makes it easier to install, uninstall or reinstall multiple MSI-installers at once. It was built for environments with regular application builds. 5 | project_url: https://github.com/nkristek/Stein 6 | date_visited: 23.01.2020 7 | order: 100 8 | --- 9 | 10 | ![Stein with light color scheme](../img/stein-light.png) 11 | ![Stein with dark color scheme](../img/stein-dark.png) 12 | -------------------------------------------------------------------------------- /docs/_expo/vnManager.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: VnManager 3 | author: Micah686 4 | tagline: "A program to keep track of your visual novels, with support for pulling in metadata" 5 | project_url: https://github.com/micah686/VnManager 6 | date_visited: 02.03.2021 7 | order: 700 8 | --- 9 | 10 | ![VnManager with dark color scheme](../img/vnManager-dark.png) 11 | -------------------------------------------------------------------------------- /docs/_expo/zen-timings.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: ZenTimings 3 | author: Ivan Rusanov 4 | tagline: "A free, simple and lightweight app for monitoring memory timings on Ryzen platform." 5 | project_url: https://github.com/irusanov/ZenTimings 6 | date_visited: 29.11.2020 7 | order: 500 8 | --- 9 | 10 | ![ZenTimings with light color scheme](../img/zen-timings-light.png) 11 | ![ZenTimings with dark color scheme](../img/zen-timings-dark.png) 12 | -------------------------------------------------------------------------------- /docs/_includes/button.html: -------------------------------------------------------------------------------- 1 | 2 | {{ include.content }} 3 | -------------------------------------------------------------------------------- /docs/_includes/cross-divider.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

5 | {{ include.quarter_0_title }} 6 |

7 |

8 | {{ include.quarter_0_description }} 9 |

10 |
11 | 12 |

13 | {{ include.quarter_1_title }} 14 |

15 |

16 | {{ include.quarter_1_description }} 17 |

18 |
19 |
20 |
21 | 22 |

23 | {{ include.quarter_2_title }} 24 |

25 |

26 | {{ include.quarter_2_description }} 27 |

28 |
29 | 30 |

31 | {{ include.quarter_3_title }} 32 |

33 |

34 | {{ include.quarter_3_description }} 35 |

36 |
37 |
38 |
-------------------------------------------------------------------------------- /docs/_includes/feature-cards.html: -------------------------------------------------------------------------------- 1 |
2 | {%- assign feature_list = site.data.features.items -%} 3 | {%- for feature in feature_list -%} 4 |
5 |

{{ feature.title }}

6 | 18 |
19 | {%- endfor -%} 20 |
-------------------------------------------------------------------------------- /docs/_includes/head_custom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/_includes/nav-docs.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/nav-expo.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/nav.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_layouts/expo.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: table_wrappers 3 | --- 4 | 5 | 6 | 7 | 8 | {% include head.html %} 9 | 10 | 11 | 12 | Link 13 | 14 | 15 | 16 | 17 | 33 | 34 |
35 | 43 |
44 |
45 |
46 |
47 | {% if site.heading_anchors != false %} 48 | {% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="" anchorClass="anchor-heading" %} 49 | {% else %} 50 | {{ content }} 51 | {% endif %} 52 | 53 | {% if site.footer_content != nil %} 54 |
55 |
56 |

{{ site.footer_content }}

57 |
58 | {% endif %} 59 | 60 |
61 |
62 |
63 |
64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/_sass/custom/cross-divider.scss: -------------------------------------------------------------------------------- 1 | .cross-divider { 2 | display: flex; 3 | flex-direction: column; 4 | 5 | .cross-divider-row { 6 | display: flex; 7 | flex-direction: column; 8 | flex: 1; 9 | border-bottom: 1px solid $grey-lt-100; 10 | 11 | &:first-child { 12 | border-top: 1px solid $grey-lt-100; 13 | } 14 | 15 | @include mq(md) { 16 | flex-direction: row; 17 | 18 | &:first-child { 19 | border-top: 0; 20 | } 21 | 22 | &:last-child { 23 | border-bottom: 0; 24 | } 25 | } 26 | 27 | .cross-divider-quarter { 28 | flex: 1; 29 | white-space: normal; 30 | padding: 0.5em 1.5em; 31 | color: $grey-dk-000; 32 | 33 | &:not(:last-child) { 34 | border-bottom: 1px solid $grey-lt-100; 35 | } 36 | 37 | @include mq(md) { 38 | &:not(:last-child) { 39 | border-bottom: 0; 40 | border-right: 1px solid $grey-lt-100; 41 | } 42 | } 43 | 44 | &::after { 45 | background-position: bottom -2em right -2em; 46 | opacity: 0.1; 47 | } 48 | 49 | &:hover, 50 | &:focus { 51 | color: $grey-dk-100; 52 | background-color: $grey-lt-100; 53 | 54 | h3 { 55 | text-decoration: underline; 56 | } 57 | } 58 | 59 | p { 60 | font-size: 14px; 61 | text-align: start; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /docs/_sass/custom/expo.scss: -------------------------------------------------------------------------------- 1 | .expo-item { 2 | margin: 4rem 0; 3 | 4 | .expo-item-title { 5 | @extend .text-small; 6 | display: flex; 7 | align-items: baseline; 8 | color: $grey-dk-000; 9 | 10 | h2 { 11 | flex: 1; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /docs/_sass/custom/feature-cards.scss: -------------------------------------------------------------------------------- 1 | .feature-list { 2 | display: flex; 3 | flex-direction: column; 4 | margin-bottom: 1em; 5 | 6 | @include mq(md) { 7 | flex-direction: row; 8 | } 9 | 10 | .feature-list-item { 11 | display: flex; 12 | flex-direction: column; 13 | flex: 1; 14 | background-color: $grey-lt-000; 15 | border-radius: $border-radius; 16 | border: $border; 17 | 18 | &:not(:last-child) { 19 | margin-bottom: 1rem; 20 | } 21 | 22 | @include mq(md) { 23 | &:not(:last-child) { 24 | margin-bottom: 0; 25 | margin-right: 1rem; 26 | } 27 | } 28 | 29 | &.item-1 { 30 | background: linear-gradient(135deg, #9688b8, #88aab8); 31 | } 32 | 33 | &.item-2 { 34 | background: linear-gradient(135deg, #88b892, #b8b788); 35 | } 36 | 37 | h3 { 38 | margin: 0; 39 | padding: 1rem; 40 | color: $white; 41 | } 42 | 43 | a { 44 | color: $grey-dk-100; 45 | background-image: none; 46 | } 47 | 48 | .feature-content { 49 | flex: 1; 50 | padding: 1rem; 51 | padding-left: 2.5rem; 52 | background: rgba(255, 255, 255, 0.5); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /docs/assets/js/custom.js: -------------------------------------------------------------------------------- 1 | const debounce = (fn) => { 2 | let frame; 3 | 4 | return (...params) => { 5 | if (frame) { 6 | cancelAnimationFrame(frame); 7 | } 8 | 9 | frame = requestAnimationFrame(() => { 10 | fn(...params); 11 | }); 12 | } 13 | }; 14 | 15 | 16 | // Reads out the scroll position and stores it in the data attribute 17 | // so we can use it in our stylesheets 18 | const storeScroll = () => { 19 | document.documentElement.dataset.scroll = window.scrollY; 20 | } 21 | 22 | // Listen for new scroll events, here we debounce our `storeScroll` function 23 | document.addEventListener('scroll', debounce(storeScroll), { passive: true }); 24 | 25 | // Update scroll position for first time 26 | storeScroll(); 27 | 28 | // Toggles the nav-open class on additional elements 29 | const initNavSearch = () => { 30 | const navTrigger = document.querySelector('.js-main-nav-trigger'); 31 | const headerNav = document.querySelector('.js-header-nav'); 32 | const search = document.querySelector('.js-search'); 33 | 34 | window.jtd.addEvent(navTrigger, 'click', function(e){ 35 | e.preventDefault(); 36 | headerNav.classList.toggle('nav-open'); 37 | search.classList.toggle('nav-open'); 38 | }); 39 | }; 40 | 41 | jtd.onReady(function(){ 42 | initNavSearch(); 43 | }); 44 | -------------------------------------------------------------------------------- /docs/assets/js/search-data.json: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | { 4 | {% assign comma = false %} 5 | {% for page in site.html_pages %}{% if page.search_exclude != true %}{% if comma == true%},{% endif %}"{{ forloop.index0 }}": { 6 | "title": "{{ page.title | replace: '&', '&' }}", 7 | "content": "{{ page.content | markdownify | replace: ' 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | ``` 30 | 31 | 3. Derive your window's style from the default style of Adonis UI: 32 | 33 | ```xml 34 | 35 | 17 | 18 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/DefaultStyles/Label.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/DefaultStyles/MessageBoxWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/DefaultStyles/StatusBar.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 35 | 36 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/DefaultStyles/TextBlock.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/DefaultStyles/Window.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 11 | 12 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/Dimensions.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 1 7 | 8 | 0 9 | 10 | 8 11 | 12 | 8 13 | 14 | 0.75 15 | 16 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/NamedStyles/SelectableTextBlockTextBox.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 14 | 15 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/Templates/Expander.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 10 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/Templates/ValidationErrorTemplate.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/AdonisUI.ClassicTheme/Themes/Themes.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, 5 | ResourceDictionaryLocation.SourceAssembly 6 | )] 7 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/AdonisUI.Demo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | netcoreapp3.1 5 | latest 6 | AdonisUI.Demo 7 | AdonisUI.Demo.App 8 | 1.17.1 9 | Demo application demonstrating AdonisUI's look and feel. 10 | benruehl 11 | benruehl 12 | AdonisUI.Demo 13 | Copyright © 2020 Benjamin Rühl 14 | MIT 15 | https://github.com/benruehl/adonis-ui 16 | https://github.com/benruehl/adonis-ui.git 17 | https://github.com/benruehl/adonis-ui/blob/master/resources/img/favicon-256x256.png?raw=true 18 | true 19 | git 20 | UI Styles Themes Templates Controls WPF XAML 21 | See release notes at https://github.com/benruehl/adonis-ui/releases 22 | en 23 | true 24 | true 25 | false 26 | App.manifest 27 | App.ico 28 | AnyCPU;x64;x86 29 | true 30 | true 31 | false 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/App.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benruehl/adonis-ui/535a89c666c99e679738d1e38ed09a1b7a9caa16/src/AdonisUI.Demo/App.ico -------------------------------------------------------------------------------- /src/AdonisUI.Demo/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace AdonisUI.Demo 9 | { 10 | /// 11 | /// Interaktionslogik für "App.xaml" 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Behaviors/HyperlinkExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Documents; 7 | 8 | namespace AdonisUI.Demo.Behaviors 9 | { 10 | static class HyperlinkExtension 11 | { 12 | public static bool GetIsExternal(DependencyObject obj) 13 | { 14 | return (bool)obj.GetValue(IsExternalProperty); 15 | } 16 | 17 | public static void SetIsExternal(DependencyObject obj, bool value) 18 | { 19 | obj.SetValue(IsExternalProperty, value); 20 | } 21 | 22 | public static readonly DependencyProperty IsExternalProperty = DependencyProperty.RegisterAttached("IsExternal", typeof(bool), typeof(HyperlinkExtension), new PropertyMetadata(false, OnIsExternalChanged)); 23 | 24 | private static void OnIsExternalChanged(object sender, DependencyPropertyChangedEventArgs args) 25 | { 26 | var hyperlink = (Hyperlink)sender; 27 | 28 | if ((bool)args.NewValue) 29 | hyperlink.RequestNavigate += Hyperlink_RequestNavigate; 30 | else 31 | hyperlink.RequestNavigate -= Hyperlink_RequestNavigate; 32 | } 33 | 34 | private static void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e) 35 | { 36 | Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true }); 37 | e.Handled = true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Commands/CollectionSampleAddItemCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using AdonisUI.Demo.Framework; 7 | using AdonisUI.Demo.ViewModels; 8 | 9 | namespace AdonisUI.Demo.Commands 10 | { 11 | class CollectionSampleAddItemCommand 12 | : ViewModelCommand 13 | { 14 | public CollectionSampleAddItemCommand(CollectionSampleViewModel contextViewModel) : base(contextViewModel) 15 | { 16 | } 17 | 18 | public override void Execute(CollectionSampleViewModel contextViewModel, object parameter) 19 | { 20 | contextViewModel.CreateItemInItems(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Commands/MessageBoxSampleShowMessageBoxCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using AdonisUI.Controls; 7 | using AdonisUI.Demo.Framework; 8 | using AdonisUI.Demo.ViewModels; 9 | 10 | namespace AdonisUI.Demo.Commands 11 | { 12 | class MessageBoxSampleShowMessageBoxCommand 13 | : ViewModelCommand 14 | { 15 | public int MessageLength { get; set; } = 100; 16 | 17 | public int CaptionLength { get; set; } = 10; 18 | 19 | public MessageBoxImage Icon { get; set; } = MessageBoxImage.Information; 20 | 21 | public IMessageBoxButtonModel[] Buttons { get; set; } = { MessageBoxButtons.Cancel() }; 22 | 23 | public IMessageBoxCheckBoxModel[] CheckBoxes { get; set; } = {}; 24 | 25 | public MessageBoxSampleShowMessageBoxCommand(MessageBoxReferenceViewModel contextViewModel) : base(contextViewModel) 26 | { 27 | } 28 | 29 | public override void Execute(MessageBoxReferenceViewModel contextViewModel, object parameter) 30 | { 31 | var messageBox = new MessageBoxModel 32 | { 33 | Text = CreateMessage(MessageLength), 34 | Caption = CreateMessage(CaptionLength), 35 | Icon = Icon, 36 | Buttons = Buttons, 37 | CheckBoxes = CheckBoxes, 38 | }; 39 | 40 | contextViewModel.CurrentMessageBox = messageBox; 41 | 42 | MessageBox.Show(messageBox); 43 | } 44 | 45 | private string CreateMessage(int charCount) 46 | { 47 | Random rng = new Random(); 48 | StringBuilder builder = new StringBuilder(charCount); 49 | 50 | while (builder.Length < charCount) 51 | { 52 | builder.Append(_availableWords[rng.Next(_availableWords.Length)]); 53 | builder.Append(" "); 54 | } 55 | 56 | return builder.ToString(); 57 | } 58 | 59 | private string[] _availableWords = 60 | { 61 | "Lorem", 62 | "ipsum", 63 | "dolor", 64 | "sit", 65 | "amet", 66 | "consetetur", 67 | "sadipscing", 68 | "elitr", 69 | "sed", 70 | "diam", 71 | "nonumy", 72 | "eirmod", 73 | "tempor", 74 | "invidunt", 75 | "ut", 76 | "labore", 77 | "et", 78 | "dolore", 79 | "magna", 80 | "aliquyam", 81 | "erat", 82 | "sed", 83 | "diam", 84 | "voluptua", 85 | }; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Converters/BoolToInverseBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | namespace AdonisUI.Demo.Converters 9 | { 10 | [ValueConversion(typeof(bool), typeof(bool))] 11 | class BoolToInverseBoolConverter 12 | : IValueConverter 13 | { 14 | public static readonly BoolToInverseBoolConverter Instance = new BoolToInverseBoolConverter(); 15 | 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | if (!(value is bool boolValue)) 19 | return DependencyProperty.UnsetValue; 20 | 21 | return !boolValue; 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | return Convert(value, targetType, parameter, culture); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Converters/ColorToHexStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | using System.Windows.Media; 8 | 9 | namespace AdonisUI.Demo.Converters 10 | { 11 | class ColorToHexStringConverter 12 | : IValueConverter 13 | { 14 | public static readonly ColorToHexStringConverter Instance = new ColorToHexStringConverter(); 15 | 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | Color color; 19 | 20 | if (value is Color c) 21 | color = c; 22 | else if (value is SolidColorBrush b) 23 | color = b.Color; 24 | else if (value is ComponentResourceKey k) 25 | { 26 | var resource = Application.Current.TryFindResource(k); 27 | 28 | if (resource is Color rc) 29 | color = rc; 30 | if (resource is SolidColorBrush rb) 31 | color = rb.Color; 32 | } 33 | else 34 | return null; 35 | 36 | return $"#{color.R:X2}{color.G:X2}{color.B:X2}"; 37 | } 38 | 39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Converters/FormatCamelCaseConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Data; 7 | 8 | namespace AdonisUI.Demo.Converters 9 | { 10 | class FormatCamelCaseConverter 11 | : IValueConverter 12 | { 13 | public static readonly FormatCamelCaseConverter Instance = new FormatCamelCaseConverter(); 14 | 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | string s = value?.ToString(); 18 | 19 | if (string.IsNullOrWhiteSpace(s)) 20 | return s; 21 | 22 | string result = s[0].ToString(); 23 | 24 | foreach (char c in s.Skip(1)) 25 | { 26 | if (char.IsUpper(c) || char.IsNumber(c)) 27 | result += " "; 28 | 29 | result += c; 30 | } 31 | 32 | return result; 33 | } 34 | 35 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 36 | { 37 | throw new NotImplementedException(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Framework/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Input; 6 | 7 | namespace AdonisUI.Demo.Framework 8 | { 9 | abstract class Command 10 | : ICommand 11 | { 12 | public abstract void Execute(object parameter); 13 | 14 | public abstract bool CanExecute(object parameter); 15 | 16 | public void RaiseCanExecuteChanged() 17 | { 18 | CanExecuteChanged?.Invoke(this, EventArgs.Empty); 19 | } 20 | 21 | public event EventHandler CanExecuteChanged; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Framework/ViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | 8 | namespace AdonisUI.Demo.Framework 9 | { 10 | class ViewModel 11 | : INotifyPropertyChanged 12 | , INotifyDataErrorInfo 13 | , IDataErrorInfo 14 | { 15 | private readonly Dictionary> _validationErrors = new Dictionary>(); 16 | 17 | public string this[string propertyName] 18 | { 19 | get 20 | { 21 | if (String.IsNullOrEmpty(propertyName)) 22 | return Error; 23 | 24 | if (_validationErrors.ContainsKey(propertyName)) 25 | return String.Join(Environment.NewLine, _validationErrors[propertyName]); 26 | 27 | return String.Empty; 28 | } 29 | } 30 | 31 | public string Error => String.Join(Environment.NewLine, GetAllErrors()); 32 | 33 | public bool HasErrors => _validationErrors.Any(); 34 | 35 | public IEnumerable GetErrors(string propertyName) 36 | { 37 | if (String.IsNullOrEmpty(propertyName)) 38 | return _validationErrors.SelectMany(kvp => kvp.Value); 39 | 40 | return _validationErrors.TryGetValue(propertyName, out var errors) ? errors : Enumerable.Empty(); 41 | } 42 | 43 | private IEnumerable GetAllErrors() 44 | { 45 | return _validationErrors.SelectMany(kvp => kvp.Value).Where(e => !String.IsNullOrEmpty(e)); 46 | } 47 | 48 | public void AddValidationError(string propertyName, string errorMessage) 49 | { 50 | if (!_validationErrors.ContainsKey(propertyName)) 51 | _validationErrors.Add(propertyName, new List()); 52 | 53 | _validationErrors[propertyName].Add(errorMessage); 54 | } 55 | 56 | public void ClearValidationErrors(string propertyName) 57 | { 58 | if (_validationErrors.ContainsKey(propertyName)) 59 | _validationErrors.Remove(propertyName); 60 | } 61 | 62 | public event PropertyChangedEventHandler PropertyChanged; 63 | public event EventHandler ErrorsChanged; 64 | 65 | protected void RaisePropertyChanged(string propertyName) 66 | { 67 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 68 | } 69 | 70 | protected virtual bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) 71 | { 72 | if (EqualityComparer.Default.Equals(storage, value)) 73 | return false; 74 | 75 | storage = value; 76 | RaisePropertyChanged(propertyName); 77 | return true; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Framework/ViewModelCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AdonisUI.Demo.Framework 7 | { 8 | abstract class ViewModelCommand 9 | : Command 10 | where TContextViewModel : ViewModel 11 | { 12 | private WeakReference _parent; 13 | 14 | public TContextViewModel ContextViewModel 15 | { 16 | get 17 | { 18 | if (_parent != null && _parent.IsAlive) 19 | return (TContextViewModel) _parent.Target; 20 | 21 | return null; 22 | } 23 | 24 | private set 25 | { 26 | if (ContextViewModel == value) 27 | return; 28 | 29 | _parent = value != null ? new WeakReference(value) : null; 30 | } 31 | } 32 | 33 | protected ViewModelCommand(TContextViewModel contextViewModel) 34 | { 35 | ContextViewModel = contextViewModel ?? throw new ArgumentNullException(nameof(contextViewModel)); 36 | } 37 | 38 | public sealed override void Execute(object parameter) 39 | { 40 | Execute(ContextViewModel, parameter); 41 | } 42 | 43 | public abstract void Execute(TContextViewModel contextViewModel, object parameter); 44 | 45 | public sealed override bool CanExecute(object parameter) 46 | { 47 | return CanExecute(ContextViewModel, parameter); 48 | } 49 | 50 | public virtual bool CanExecute(TContextViewModel contextViewModel, object parameter) 51 | { 52 | return true; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Data; 11 | using System.Windows.Documents; 12 | using System.Windows.Input; 13 | using System.Windows.Media; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Navigation; 16 | using System.Windows.Shapes; 17 | using AdonisUI.Controls; 18 | using AdonisUI.Demo.ViewModels; 19 | 20 | namespace AdonisUI.Demo 21 | { 22 | /// 23 | /// Interaction logic for MainWindow.xaml 24 | /// 25 | public partial class MainWindow : AdonisWindow 26 | { 27 | public bool IsDark 28 | { 29 | get => (bool)GetValue(IsDarkProperty); 30 | set => SetValue(IsDarkProperty, value); 31 | } 32 | 33 | public static readonly DependencyProperty IsDarkProperty = DependencyProperty.Register("IsDark", typeof(bool), typeof(MainWindow), new PropertyMetadata(false, OnIsDarkChanged)); 34 | 35 | private static void OnIsDarkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 36 | { 37 | ((MainWindow) d).ChangeTheme((bool)e.OldValue); 38 | } 39 | 40 | public MainWindow() 41 | { 42 | DataContext = new ApplicationViewModel(); 43 | InitializeComponent(); 44 | } 45 | 46 | private void ChangeTheme(bool oldValue) 47 | { 48 | ResourceLocator.SetColorScheme(Application.Current.Resources, oldValue ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Services/IItemGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdonisUI.Demo.ViewModels; 5 | 6 | namespace AdonisUI.Demo.Services 7 | { 8 | interface IItemGenerator 9 | { 10 | IEnumerable CreateDummyItems(int count, double childCreationProbability, Random random); 11 | 12 | ItemViewModel CreateItemInItems(ICollection existingItems); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Services/ItemGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.ViewModels; 6 | 7 | namespace AdonisUI.Demo.Services 8 | { 9 | class ItemGenerator 10 | : IItemGenerator 11 | { 12 | public IEnumerable CreateDummyItems(int count, double childCreationProbability, Random random) 13 | { 14 | for (int i = 0; i < count; i++) 15 | { 16 | var item = new ItemViewModel 17 | { 18 | Name = CreateItemName(i + 1), 19 | Weight = random.NextDouble(), 20 | }; 21 | 22 | if (random.NextDouble() <= childCreationProbability) 23 | { 24 | foreach (ItemViewModel child in CreateDummyItems(random.Next(count), childCreationProbability, random)) 25 | { 26 | item.AddChild(child); 27 | } 28 | } 29 | 30 | yield return item; 31 | } 32 | } 33 | 34 | public ItemViewModel CreateItemInItems(ICollection existingItems) 35 | { 36 | var newItem = new ItemViewModel 37 | { 38 | Name = GetNextUniqueItemName(existingItems), 39 | Weight = new Random().NextDouble(), 40 | }; 41 | 42 | existingItems.Add(newItem); 43 | return newItem; 44 | } 45 | 46 | private string GetNextUniqueItemName(ICollection existingItems) 47 | { 48 | int iteration = 1; 49 | string itemName = CreateItemName(iteration); 50 | 51 | while (existingItems.Any(item => item.Name == itemName)) 52 | { 53 | iteration++; 54 | itemName = CreateItemName(iteration); 55 | } 56 | 57 | return itemName; 58 | } 59 | 60 | private string CreateItemName(int itemId) 61 | { 62 | return $"Item {itemId}"; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Styles/ControlReferenceSectionStyle.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 18 | 19 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Styles/ItemGroupLabelStyle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 15 | 16 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Themes/Themes.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, 5 | ResourceDictionaryLocation.SourceAssembly 6 | )] 7 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ApplicationNavigationGroup.cs: -------------------------------------------------------------------------------- 1 | namespace AdonisUI.Demo.ViewModels 2 | { 3 | enum ApplicationNavigationGroup 4 | { 5 | Samples, 6 | IssueScenarios, 7 | Reference, 8 | } 9 | } -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/BrushResourceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Media; 7 | using AdonisUI.Demo.Framework; 8 | 9 | namespace AdonisUI.Demo.ViewModels 10 | { 11 | class BrushResourceViewModel 12 | : ViewModel 13 | { 14 | public enum BrushGroup 15 | { 16 | Foreground, 17 | Accent, 18 | Layer0, 19 | Layer1, 20 | Layer2, 21 | Layer3, 22 | Layer4, 23 | Disabled, 24 | Status, 25 | Controls, 26 | } 27 | 28 | private ComponentResourceKey _resourceKey; 29 | 30 | public ComponentResourceKey ResourceKey 31 | { 32 | get => _resourceKey; 33 | set 34 | { 35 | SetProperty(ref _resourceKey, value); 36 | SetProperty(ref _group, DetermineGroup()); 37 | RaisePropertyChanged(nameof(ShortName)); 38 | } 39 | } 40 | 41 | public string Name 42 | { 43 | get => _resourceKey.ResourceId.ToString(); 44 | } 45 | 46 | public string ShortName 47 | { 48 | get 49 | { 50 | if (Name.EndsWith("Brush")) 51 | return Name.Substring(0, Name.Length - "Brush".Length); 52 | 53 | return Name; 54 | } 55 | } 56 | 57 | public string ColorName 58 | { 59 | get 60 | { 61 | if (!_isBasedOnColorResource || !Name.EndsWith("Brush")) 62 | return null; 63 | 64 | return ShortName + "Color"; 65 | } 66 | } 67 | 68 | private bool _isBasedOnColorResource; 69 | 70 | public bool IsBasedOnColorResource 71 | { 72 | get => _isBasedOnColorResource; 73 | set => SetProperty(ref _isBasedOnColorResource, value); 74 | } 75 | 76 | private BrushGroup _group; 77 | 78 | public BrushGroup Group 79 | { 80 | get => _group; 81 | set => SetProperty(ref _group, value); 82 | } 83 | 84 | private BrushGroup DetermineGroup() 85 | { 86 | string brushName = _resourceKey.ResourceId.ToString(); 87 | 88 | foreach (BrushGroup availableGroup in Enum.GetValues(typeof(BrushGroup))) 89 | { 90 | if (brushName.StartsWith(availableGroup.ToString())) 91 | return availableGroup; 92 | } 93 | 94 | string[] statusKeywords = { "success", "error", "alert" }; 95 | 96 | if (statusKeywords.Any(keyword => brushName.Contains(keyword, StringComparison.InvariantCultureIgnoreCase))) 97 | return BrushGroup.Status; 98 | 99 | return BrushGroup.Controls; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ButtonReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdonisUI.Demo.Framework; 5 | 6 | namespace AdonisUI.Demo.ViewModels 7 | { 8 | class ButtonReferenceViewModel 9 | : ViewModel 10 | , IApplicationContentView 11 | { 12 | public string Name => "Buttons"; 13 | 14 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 15 | 16 | private bool _isLoading; 17 | 18 | public bool IsLoading 19 | { 20 | get => _isLoading; 21 | set => SetProperty(ref _isLoading, value); 22 | } 23 | 24 | public void Init() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/CollectionSampleViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Threading; 8 | using AdonisUI.Demo.Commands; 9 | using AdonisUI.Demo.Framework; 10 | using AdonisUI.Demo.Services; 11 | 12 | namespace AdonisUI.Demo.ViewModels 13 | { 14 | class CollectionSampleViewModel 15 | : ViewModel 16 | , IApplicationContentView 17 | { 18 | public string Name => "Collections"; 19 | 20 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Samples; 21 | 22 | private bool _isLoading; 23 | 24 | public bool IsLoading 25 | { 26 | get => _isLoading; 27 | set => SetProperty(ref _isLoading, value); 28 | } 29 | 30 | private readonly ObservableCollection _items = new ObservableCollection(); 31 | public ReadOnlyObservableCollection Items { get; set; } 32 | 33 | private readonly IItemGenerator _itemGenerator; 34 | 35 | public CollectionSampleViewModel(IItemGenerator itemGenerator) 36 | { 37 | _itemGenerator = itemGenerator; 38 | Items = new ReadOnlyObservableCollection(_items); 39 | } 40 | 41 | public void Init() 42 | { 43 | Dispatch(() => _items.Clear()); 44 | AddDummyItems(50); 45 | } 46 | 47 | private void AddDummyItems(int count) 48 | { 49 | foreach (ItemViewModel item in _itemGenerator.CreateDummyItems(count, 0.25, new Random())) 50 | { 51 | Dispatch(() => _items.Add(item)); 52 | } 53 | } 54 | 55 | public ItemViewModel CreateItemInItems() 56 | { 57 | return _itemGenerator.CreateItemInItems(_items); 58 | } 59 | 60 | private void Dispatch(Action action) 61 | { 62 | Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, action); 63 | } 64 | 65 | private CollectionSampleAddItemCommand _addItemCommand; 66 | 67 | public CollectionSampleAddItemCommand AddItemCommand => _addItemCommand ?? (_addItemCommand = new CollectionSampleAddItemCommand(this)); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ColorReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Windows; 8 | using System.Windows.Media; 9 | using System.Windows.Threading; 10 | using AdonisUI.Demo.Framework; 11 | 12 | namespace AdonisUI.Demo.ViewModels 13 | { 14 | class ColorReferenceViewModel 15 | : ViewModel 16 | , IApplicationContentView 17 | { 18 | public string Name => "Colors"; 19 | 20 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 21 | 22 | private bool _isLoading; 23 | 24 | public bool IsLoading 25 | { 26 | get => _isLoading; 27 | set => SetProperty(ref _isLoading, value); 28 | } 29 | 30 | private readonly ObservableCollection _brushes; 31 | 32 | public ReadOnlyObservableCollection Brushes { get; } 33 | 34 | public ColorReferenceViewModel() 35 | { 36 | _brushes = new ObservableCollection(); 37 | Brushes = new ReadOnlyObservableCollection(_brushes); 38 | } 39 | 40 | public void Init() 41 | { 42 | Dispatch(InitBrushes); 43 | } 44 | 45 | private void InitBrushes() 46 | { 47 | _brushes.Clear(); 48 | 49 | IEnumerable brushKeys = typeof(Brushes).GetProperties().Select(p => (ComponentResourceKey)p.GetValue(null, null)); 50 | 51 | foreach (var brushKey in brushKeys) 52 | { 53 | var brushResource = new BrushResourceViewModel 54 | { 55 | ResourceKey = brushKey, 56 | }; 57 | 58 | brushResource.IsBasedOnColorResource = typeof(Colors).GetProperty(brushResource.ShortName + "Color") != null; 59 | 60 | _brushes.Add(brushResource); 61 | } 62 | } 63 | 64 | private void Dispatch(Action action) 65 | { 66 | Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, action); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/IApplicationContentView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AdonisUI.Demo.ViewModels 7 | { 8 | interface IApplicationContentView 9 | { 10 | string Name { get; } 11 | 12 | ApplicationNavigationGroup Group { get; } 13 | 14 | bool IsLoading { get; set; } 15 | 16 | void Init(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/Issue101ScenarioViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class Issue101ScenarioViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Issue 101"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.IssueScenarios; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | private bool _isIndeterminate; 26 | 27 | public bool IsIndeterminate 28 | { 29 | get => _isIndeterminate; 30 | set => SetProperty(ref _isIndeterminate, value); 31 | } 32 | 33 | public void Init() 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/Issue23ScenarioViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class Issue23ScenarioViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Issue 23"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.IssueScenarios; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | public void Init() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/Issue26ScenarioViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class Issue26ScenarioViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Issue 26"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.IssueScenarios; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | public void Init() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/Issue5ScenarioViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class Issue5ScenarioViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Issue 5"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.IssueScenarios; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | public void Init() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/IssueDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using AdonisUI.Demo.Framework; 7 | 8 | namespace AdonisUI.Demo.ViewModels 9 | { 10 | class IssueDialogViewModel 11 | : ViewModel 12 | { 13 | private readonly ObservableCollection _items = new ObservableCollection(); 14 | public ReadOnlyObservableCollection Items { get; set; } 15 | 16 | public IssueDialogViewModel() 17 | { 18 | Items = new ReadOnlyObservableCollection(_items); 19 | 20 | AddDummyItems(3); 21 | } 22 | 23 | private void AddDummyItems(int count) 24 | { 25 | foreach (ItemViewModel item in CreateDummyItems(count)) 26 | { 27 | _items.Add(item); 28 | } 29 | } 30 | 31 | private IEnumerable CreateDummyItems(int count) 32 | { 33 | for (int i = 0; i < count; i++) 34 | { 35 | var item = new ItemViewModel 36 | { 37 | Name = $"Item {i + 1}", 38 | }; 39 | 40 | yield return item; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/IssueRippleContentInvisibleScenarioViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class IssueRippleContentInvisibleScenarioViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Ripple content visible"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.IssueScenarios; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | public void Init() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ItemViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using AdonisUI.Demo.Framework; 7 | 8 | namespace AdonisUI.Demo.ViewModels 9 | { 10 | class ItemViewModel 11 | : ViewModel 12 | { 13 | private string _name; 14 | public string Name 15 | { 16 | get => _name; 17 | set 18 | { 19 | if (_name != value) 20 | { 21 | _name = value; 22 | 23 | ClearValidationErrors(nameof(Name)); 24 | 25 | if (String.IsNullOrEmpty(value)) 26 | AddValidationError(nameof(Name), "Name must not be null or empty."); 27 | 28 | RaisePropertyChanged(nameof(Name)); 29 | } 30 | } 31 | } 32 | 33 | private double _weight; 34 | 35 | public double Weight 36 | { 37 | get => _weight; 38 | set 39 | { 40 | if (_weight != value) 41 | { 42 | _weight = value; 43 | 44 | RaisePropertyChanged(nameof(Weight)); 45 | } 46 | } 47 | } 48 | 49 | private bool _flag; 50 | public bool Flag 51 | { 52 | get => _flag; 53 | set 54 | { 55 | if (_flag != value) 56 | { 57 | _flag = value; 58 | 59 | RaisePropertyChanged(nameof(Flag)); 60 | } 61 | } 62 | } 63 | 64 | private readonly ObservableCollection _children = new ObservableCollection(); 65 | 66 | public ReadOnlyObservableCollection Children { get; set; } 67 | 68 | public ItemViewModel() 69 | { 70 | Children = new ReadOnlyObservableCollection(_children); 71 | } 72 | 73 | public void AddChild(ItemViewModel child) 74 | { 75 | _children.Add(child); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/LayerSampleViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class LayerSampleViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Layers (Complex)"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Samples; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | public void Init() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/LayerSimpleSampleViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class LayerSimpleSampleViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Layers"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Samples; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | public void Init() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ListBoxReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdonisUI.Demo.Framework; 5 | 6 | namespace AdonisUI.Demo.ViewModels 7 | { 8 | class ListBoxReferenceViewModel 9 | : ViewModel 10 | , IApplicationContentView 11 | { 12 | public string Name => "List Boxes"; 13 | 14 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 15 | 16 | private bool _isLoading; 17 | 18 | public bool IsLoading 19 | { 20 | get => _isLoading; 21 | set => SetProperty(ref _isLoading, value); 22 | } 23 | 24 | public void Init() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/LoadingReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdonisUI.Demo.Framework; 5 | 6 | namespace AdonisUI.Demo.ViewModels 7 | { 8 | class LoadingReferenceViewModel 9 | : ViewModel 10 | , IApplicationContentView 11 | { 12 | public string Name => "Loading"; 13 | 14 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 15 | 16 | private bool _isLoading; 17 | 18 | public bool IsLoading 19 | { 20 | get => _isLoading; 21 | set => SetProperty(ref _isLoading, value); 22 | } 23 | 24 | public void Init() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/OverviewSampleViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class OverviewSampleViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Overview"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Samples; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | public void Init() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ScrollBarReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Threading; 7 | using AdonisUI.Demo.Framework; 8 | using AdonisUI.Demo.Services; 9 | 10 | namespace AdonisUI.Demo.ViewModels 11 | { 12 | class ScrollBarReferenceViewModel 13 | : ViewModel 14 | , IApplicationContentView 15 | { 16 | public string Name => "Scroll Bars"; 17 | 18 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 19 | 20 | private bool _isLoading; 21 | 22 | public bool IsLoading 23 | { 24 | get => _isLoading; 25 | set => SetProperty(ref _isLoading, value); 26 | } 27 | 28 | private readonly ObservableCollection _items = new ObservableCollection(); 29 | public ReadOnlyObservableCollection Items { get; set; } 30 | 31 | private readonly IItemGenerator _itemGenerator; 32 | 33 | public ScrollBarReferenceViewModel(IItemGenerator itemGenerator) 34 | { 35 | _itemGenerator = itemGenerator; 36 | Items = new ReadOnlyObservableCollection(_items); 37 | } 38 | 39 | public void Init() 40 | { 41 | Dispatch(() => _items.Clear()); 42 | AddDummyItems(25); 43 | } 44 | 45 | private void AddDummyItems(int count) 46 | { 47 | foreach (ItemViewModel item in _itemGenerator.CreateDummyItems(count, 0, new Random())) 48 | { 49 | Dispatch(() => _items.Add(item)); 50 | } 51 | } 52 | 53 | private void Dispatch(Action action) 54 | { 55 | Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, action); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/TextInputReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdonisUI.Demo.Framework; 5 | 6 | namespace AdonisUI.Demo.ViewModels 7 | { 8 | class TextInputReferenceViewModel 9 | : ViewModel 10 | , IApplicationContentView 11 | { 12 | public string Name => "Text Input"; 13 | 14 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 15 | 16 | private bool _isLoading; 17 | 18 | public bool IsLoading 19 | { 20 | get => _isLoading; 21 | set => SetProperty(ref _isLoading, value); 22 | } 23 | 24 | public void Init() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ToggleReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdonisUI.Demo.Framework; 5 | 6 | namespace AdonisUI.Demo.ViewModels 7 | { 8 | class ToggleReferenceViewModel 9 | : ViewModel 10 | , IApplicationContentView 11 | { 12 | public string Name => "Toggles"; 13 | 14 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 15 | 16 | private bool _isLoading; 17 | 18 | public bool IsLoading 19 | { 20 | get => _isLoading; 21 | set => SetProperty(ref _isLoading, value); 22 | } 23 | 24 | public void Init() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ToolBarReferenceViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdonisUI.Demo.Framework; 5 | 6 | namespace AdonisUI.Demo.ViewModels 7 | { 8 | class ToolBarReferenceViewModel 9 | : ViewModel 10 | , IApplicationContentView 11 | { 12 | public string Name => "Tool Bars"; 13 | 14 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Reference; 15 | 16 | private bool _isLoading; 17 | 18 | public bool IsLoading 19 | { 20 | get => _isLoading; 21 | set => SetProperty(ref _isLoading, value); 22 | } 23 | 24 | public void Init() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/ViewModels/ValidationSampleViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using AdonisUI.Demo.Framework; 6 | 7 | namespace AdonisUI.Demo.ViewModels 8 | { 9 | class ValidationSampleViewModel 10 | : ViewModel 11 | , IApplicationContentView 12 | { 13 | public string Name => "Validation"; 14 | 15 | public ApplicationNavigationGroup Group => ApplicationNavigationGroup.Samples; 16 | 17 | private bool _isLoading; 18 | 19 | public bool IsLoading 20 | { 21 | get => _isLoading; 22 | set => SetProperty(ref _isLoading, value); 23 | } 24 | 25 | private string _stringValue; 26 | public string StringValue 27 | { 28 | get => _stringValue; 29 | set 30 | { 31 | if (_stringValue != value) 32 | { 33 | _stringValue = value; 34 | 35 | ValidateStringValue(); 36 | 37 | RaisePropertyChanged(nameof(StringValue)); 38 | } 39 | } 40 | } 41 | 42 | private bool _boolValue; 43 | public bool BoolValue 44 | { 45 | get => _boolValue; 46 | set 47 | { 48 | if (_boolValue != value) 49 | { 50 | _boolValue = value; 51 | 52 | ValidateBoolValue(); 53 | 54 | RaisePropertyChanged(nameof(BoolValue)); 55 | } 56 | } 57 | } 58 | 59 | public void Init() 60 | { 61 | ValidateStringValue(); 62 | ValidateBoolValue(); 63 | } 64 | 65 | private void ValidateStringValue() 66 | { 67 | ClearValidationErrors("StringValue"); 68 | 69 | if (String.IsNullOrEmpty(StringValue)) 70 | AddValidationError("StringValue", "Value must not be null or empty."); 71 | 72 | if (String.Equals(StringValue, "Error", StringComparison.InvariantCultureIgnoreCase)) 73 | AddValidationError("StringValue", "Value must not equal 'Error'."); 74 | } 75 | 76 | private void ValidateBoolValue() 77 | { 78 | ClearValidationErrors("BoolValue"); 79 | 80 | if (!BoolValue) 81 | AddValidationError("BoolValue", "Value must not be false."); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/ControlBrushesBreakdown.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Imaging; 11 | using System.Windows.Navigation; 12 | using System.Windows.Shapes; 13 | 14 | namespace AdonisUI.Demo.Views 15 | { 16 | /// 17 | /// Interaction logic for ControlBrushesBreakdown.xaml 18 | /// 19 | public partial class ControlBrushesBreakdown : UserControl 20 | { 21 | public double MouseX 22 | { 23 | get => (double)GetValue(MouseXProperty); 24 | set => SetValue(MouseXProperty, value); 25 | } 26 | 27 | public double MouseY 28 | { 29 | get => (double)GetValue(MouseYProperty); 30 | set => SetValue(MouseYProperty, value); 31 | } 32 | 33 | public static readonly DependencyProperty MouseXProperty = DependencyProperty.Register("MouseX", typeof(double), typeof(ControlBrushesBreakdown), new PropertyMetadata(0.0)); 34 | 35 | public static readonly DependencyProperty MouseYProperty = DependencyProperty.Register("MouseY", typeof(double), typeof(ControlBrushesBreakdown), new PropertyMetadata(0.0)); 36 | 37 | public ControlBrushesBreakdown() 38 | { 39 | InitializeComponent(); 40 | } 41 | 42 | public override void OnApplyTemplate() 43 | { 44 | var canvas = (FrameworkElement)Template.FindName("Canvas", this); 45 | canvas.MouseMove += Container_OnMouseMove; 46 | } 47 | 48 | private void Container_OnMouseMove(object sender, MouseEventArgs e) 49 | { 50 | var canvas = (Canvas)sender; 51 | Point pos = e.GetPosition(canvas); 52 | MouseX = pos.X; 53 | MouseY = pos.Y; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/ControlReferenceControl.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/ControlReferenceControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Markup; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace AdonisUI.Demo.Views 16 | { 17 | /// 18 | /// Interaction logic for ControlReferenceControl.xaml 19 | /// 20 | [ContentProperty(nameof(ReferenceContent))] 21 | public partial class ControlReferenceControl : UserControl 22 | { 23 | public ControlReferenceControl() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | public string Title 29 | { 30 | get => (string)GetValue(TitleProperty); 31 | set => SetValue(TitleProperty, value); 32 | } 33 | 34 | public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(ControlReferenceControl), new PropertyMetadata(null)); 35 | 36 | public object ReferenceContent 37 | { 38 | get => (object)GetValue(ReferenceContentProperty); 39 | set => SetValue(ReferenceContentProperty, value); 40 | } 41 | 42 | public static readonly DependencyProperty ReferenceContentProperty = DependencyProperty.Register("ReferenceContent", typeof(object), typeof(ControlReferenceControl), new PropertyMetadata(null)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/Issue101Scenario.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/Issue23Scenario.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/Issue5Scenario.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/IssueScenarioControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Navigation; 5 | 6 | namespace AdonisUI.Demo.Views 7 | { 8 | /// 9 | /// Interaktionslogik für IssueScenarioControl.xaml 10 | /// 11 | public partial class IssueScenarioControl : UserControl 12 | { 13 | public IssueScenarioControl() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | 19 | public string IssueTitle 20 | { 21 | get { return (string)GetValue(IssueTitleProperty); } 22 | set { SetValue(IssueTitleProperty, value); } 23 | } 24 | 25 | public static readonly DependencyProperty IssueTitleProperty = DependencyProperty.Register("IssueTitle", typeof(string), typeof(IssueScenarioControl), new PropertyMetadata(null)); 26 | 27 | 28 | 29 | public string IssueDescription 30 | { 31 | get { return (string)GetValue(IssueDescriptionProperty); } 32 | set { SetValue(IssueDescriptionProperty, value); } 33 | } 34 | 35 | public static readonly DependencyProperty IssueDescriptionProperty = DependencyProperty.Register("IssueDescription", typeof(string), typeof(IssueScenarioControl), new PropertyMetadata(null)); 36 | 37 | 38 | 39 | public string StepsToReproduce 40 | { 41 | get { return (string)GetValue(StepsToReproduceProperty); } 42 | set { SetValue(StepsToReproduceProperty, value); } 43 | } 44 | 45 | public static readonly DependencyProperty StepsToReproduceProperty = DependencyProperty.Register("StepsToReproduce", typeof(string), typeof(IssueScenarioControl), new PropertyMetadata(null)); 46 | 47 | 48 | 49 | public string IssueLink 50 | { 51 | get { return (string)GetValue(IssueLinkProperty); } 52 | set { SetValue(IssueLinkProperty, value); } 53 | } 54 | 55 | public static readonly DependencyProperty IssueLinkProperty = DependencyProperty.Register("IssueLink", typeof(string), typeof(IssueScenarioControl), new PropertyMetadata(null)); 56 | 57 | 58 | 59 | public DependencyObject IssueContent 60 | { 61 | get { return (DependencyObject)GetValue(IssueContentProperty); } 62 | set { SetValue(IssueContentProperty, value); } 63 | } 64 | 65 | public static readonly DependencyProperty IssueContentProperty = DependencyProperty.Register("IssueContent", typeof(DependencyObject), typeof(IssueScenarioControl), new PropertyMetadata(null)); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AdonisUI.Demo/Views/ScrollBarReference.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Input; 7 | 8 | namespace AdonisUI.Demo.Views 9 | { 10 | public partial class ScrollBarReference : ResourceDictionary 11 | { 12 | private void HorizontalScrollDemo_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e) 13 | { 14 | var scrollViewer = ((ScrollViewer) sender); 15 | scrollViewer.ScrollToHorizontalOffset(scrollViewer.ContentHorizontalOffset - e.Delta); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AdonisUI.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29613.14 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdonisUI", "AdonisUI\AdonisUI.csproj", "{45E54988-48A0-43AB-810B-0EE50E77F8FC}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdonisUI.Demo", "AdonisUI.Demo\AdonisUI.Demo.csproj", "{BB83094A-C51A-41DA-8A74-C0B41E84539A}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdonisUI.ClassicTheme", "AdonisUI.ClassicTheme\AdonisUI.ClassicTheme.csproj", "{1C41D016-993D-41B5-B9DB-4581867829D6}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {45E54988-48A0-43AB-810B-0EE50E77F8FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {45E54988-48A0-43AB-810B-0EE50E77F8FC}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {45E54988-48A0-43AB-810B-0EE50E77F8FC}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {45E54988-48A0-43AB-810B-0EE50E77F8FC}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {BB83094A-C51A-41DA-8A74-C0B41E84539A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {BB83094A-C51A-41DA-8A74-C0B41E84539A}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {BB83094A-C51A-41DA-8A74-C0B41E84539A}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {BB83094A-C51A-41DA-8A74-C0B41E84539A}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {1C41D016-993D-41B5-B9DB-4581867829D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {1C41D016-993D-41B5-B9DB-4581867829D6}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {1C41D016-993D-41B5-B9DB-4581867829D6}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {1C41D016-993D-41B5-B9DB-4581867829D6}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {031E44CB-D4B2-4C16-863E-A3D94DD55C4B} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /src/AdonisUI/AdonisUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net45;netcoreapp3.1;net5.0-windows 5 | latest 6 | true 7 | true 8 | true 9 | 10 | 11 | 12 | 13 | 1.17.1 14 | Core theme definitions for AdonisUI - a lightweight UI toolkit for WPF applications offering classic but enhanced windows visuals 15 | benruehl 16 | benruehl 17 | AdonisUI 18 | Copyright © 2020 Benjamin Rühl 19 | MIT 20 | https://github.com/benruehl/adonis-ui 21 | https://github.com/benruehl/adonis-ui.git 22 | git 23 | UI Styles Themes Templates Controls WPF XAML 24 | See release notes at https://github.com/benruehl/adonis-ui/releases 25 | en 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | favicon-256x256.png 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/AdornerPlacement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AdonisUI.Controls 7 | { 8 | public enum AdornerPlacement 9 | { 10 | Inside, 11 | Outside, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/IMessageBoxButtonModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Controls 8 | { 9 | /// 10 | /// Exposes properties used to configure the appearance and behavior of a single button of some . 11 | /// 12 | public interface IMessageBoxButtonModel 13 | { 14 | /// 15 | /// An that can be used to identify the button. 16 | /// 17 | object Id { get; } 18 | 19 | /// 20 | /// A that specifies the content of the button. 21 | /// 22 | string Label { get; } 23 | 24 | /// 25 | /// A that will be used as of the parent message box if the button is pressed. 26 | /// 27 | MessageBoxResult CausedResult { get; } 28 | 29 | /// 30 | /// A that specifies if the button should be preselected when opening the message box. 31 | /// 32 | bool IsDefault { get; set; } 33 | 34 | /// 35 | /// A that specifies if the button should be pressed when the user presses the escape key. 36 | /// If at least one button in has this property set to the displays the window close button. 37 | /// 38 | bool IsCancel { get; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/IMessageBoxCheckBoxModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Controls 8 | { 9 | /// 10 | /// Exposes properties used to configure the appearance and behavior of a single check box of some . 11 | /// 12 | public interface IMessageBoxCheckBoxModel 13 | { 14 | /// 15 | /// A that specifies the content of the check box. 16 | /// 17 | string Label { get; } 18 | 19 | /// 20 | /// A that specifies if the check box is checked. 21 | /// 22 | bool IsChecked { get; } 23 | 24 | /// 25 | /// A that specifies where the check box is placed inside the message box. 26 | /// 27 | MessageBoxCheckBoxPlacement Placement { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/IMessageBoxModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Controls 8 | { 9 | /// 10 | /// Exposes properties used to configure the appearance and behavior of a . 11 | /// 12 | public interface IMessageBoxModel 13 | { 14 | /// 15 | /// A that specifies the text to display. 16 | /// 17 | string Text { get; } 18 | 19 | /// 20 | /// A that specifies the title bar caption to display. 21 | /// 22 | string Caption { get; } 23 | 24 | /// 25 | /// A collection of that specifies which buttons to display. 26 | /// 27 | IEnumerable Buttons { get; } 28 | 29 | /// 30 | /// A collection of that specifies which check boxes to display. 31 | /// 32 | IEnumerable CheckBoxes { get; } 33 | 34 | /// 35 | /// A value that specifies the icon to display. 36 | /// 37 | MessageBoxImage Icon { get; } 38 | 39 | /// 40 | /// A value that specifies the result the message box button that was clicked by the user returned. 41 | /// 42 | MessageBoxResult Result { get; set; } 43 | 44 | /// 45 | /// An that specifies which message box button is clicked by the user. 46 | /// 47 | IMessageBoxButtonModel ButtonPressed { get; set; } 48 | 49 | /// 50 | /// Specifies whether a system sound is played when the message box window opens. Which sound is played depends on the . 51 | /// 52 | bool IsSoundEnabled { get; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/MessageBoxButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Controls 8 | { 9 | /// 10 | /// Specifies the buttons that are displayed on a message box. 11 | /// 12 | public enum MessageBoxButton 13 | { 14 | /// 15 | /// The message box displays an OK button. 16 | /// 17 | OK = 0, 18 | 19 | /// 20 | /// The message box displays OK and Cancel buttons. 21 | /// 22 | OKCancel = 1, 23 | 24 | /// 25 | /// The message box displays Yes, No and Cancel buttons. 26 | /// 27 | YesNoCancel = 3, 28 | 29 | /// 30 | /// The message box displays Yes and No buttons. 31 | /// 32 | YesNo = 4, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/MessageBoxButtonModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Runtime.CompilerServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using AdonisUI.ViewModels; 9 | 10 | namespace AdonisUI.Controls 11 | { 12 | /// 13 | /// The default implementation of used to configure the appearance and behavior of a single button of some . 14 | /// 15 | public class MessageBoxButtonModel 16 | : PropertyChangedBase 17 | , IMessageBoxButtonModel 18 | { 19 | private object _id; 20 | 21 | /// 22 | public object Id 23 | { 24 | get => _id; 25 | set => SetProperty(ref _id, value); 26 | } 27 | 28 | private string _label; 29 | 30 | /// 31 | public string Label 32 | { 33 | get => _label; 34 | set => SetProperty(ref _label, value); 35 | } 36 | 37 | private MessageBoxResult _causedResult; 38 | 39 | /// 40 | public MessageBoxResult CausedResult 41 | { 42 | get => _causedResult; 43 | set => SetProperty(ref _causedResult, value); 44 | } 45 | 46 | private bool _isDefault; 47 | 48 | /// 49 | public bool IsDefault 50 | { 51 | get => _isDefault; 52 | set => SetProperty(ref _isDefault, value); 53 | } 54 | 55 | private bool _isCancel; 56 | 57 | /// 58 | public bool IsCancel 59 | { 60 | get => _isCancel; 61 | set => SetProperty(ref _isCancel, value); 62 | } 63 | 64 | /// 65 | /// Creates an instance of . 66 | /// 67 | /// A that specifies the content of the button. 68 | /// A that will be used as of the parent message box if the button is pressed. 69 | public MessageBoxButtonModel(string label, MessageBoxResult causedResult) 70 | { 71 | Label = label; 72 | CausedResult = causedResult; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/MessageBoxCheckBoxModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using AdonisUI.ViewModels; 7 | 8 | namespace AdonisUI.Controls 9 | { 10 | /// 11 | /// The default implementation of used to configure the appearance and behavior of a single check box of some . 12 | /// 13 | public class MessageBoxCheckBoxModel 14 | : PropertyChangedBase 15 | , IMessageBoxCheckBoxModel 16 | { 17 | private object _id; 18 | 19 | /// 20 | /// An that can be used to identify the check box. 21 | /// 22 | public object Id 23 | { 24 | get => _id; 25 | set => SetProperty(ref _id, value); 26 | } 27 | 28 | private string _label; 29 | 30 | /// 31 | public string Label 32 | { 33 | get => _label; 34 | set => SetProperty(ref _label, value); 35 | } 36 | 37 | private bool _isChecked; 38 | 39 | /// 40 | public bool IsChecked 41 | { 42 | get => _isChecked; 43 | set => SetProperty(ref _isChecked, value); 44 | } 45 | 46 | private MessageBoxCheckBoxPlacement _placement; 47 | 48 | /// 49 | public MessageBoxCheckBoxPlacement Placement 50 | { 51 | get => _placement; 52 | set => SetProperty(ref _placement, value); 53 | } 54 | 55 | /// 56 | /// Creates an instance of . 57 | /// 58 | /// A that specifies the content of the check box. 59 | public MessageBoxCheckBoxModel(string label) 60 | { 61 | _label = label; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/MessageBoxCheckBoxPlacement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Controls 8 | { 9 | /// 10 | /// Specifies where a check box is placed inside a message box. 11 | /// 12 | public enum MessageBoxCheckBoxPlacement 13 | { 14 | /// 15 | /// The check box is placed below the message box's text. 16 | /// 17 | BelowText, 18 | 19 | /// 20 | /// The check box is placed next to the message box's buttons inside the button row. 21 | /// 22 | NextToButtons, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/MessageBoxImage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Controls 8 | { 9 | public enum MessageBoxImage 10 | { 11 | None, 12 | Hand, 13 | Stop, 14 | Error, 15 | Question, 16 | Exclamation, 17 | Warning, 18 | Asterisk, 19 | Information, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/MessageBoxResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Controls 8 | { 9 | public enum MessageBoxResult 10 | { 11 | None, 12 | OK, 13 | Cancel, 14 | Yes, 15 | No, 16 | Custom, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/RippleHost.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 33 | 34 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/SortGlyphAdorner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media; 9 | 10 | namespace AdonisUI.Controls 11 | { 12 | public class SortGlyphAdorner 13 | : FrameworkElementAdorner 14 | { 15 | public SortGlyphAdorner(FrameworkElement adornedElement, FrameworkElement sortGlyph) 16 | : base(sortGlyph, adornedElement, AdornerPlacement.Inside, AdornerPlacement.Inside, 0, 0) 17 | { 18 | } 19 | 20 | public SortGlyphAdorner(FrameworkElement adornedElement, ListSortDirection direction) 21 | : base(CreateDefaultSortGlyph(direction), adornedElement, AdornerPlacement.Inside, AdornerPlacement.Inside, 0, 0) 22 | { 23 | } 24 | 25 | private static FrameworkElement CreateDefaultSortGlyph(ListSortDirection direction) 26 | { 27 | DataTemplate expanderTemplate = Application.Current.TryFindResource(AdonisUI.Templates.Expander) as DataTemplate; 28 | 29 | if (expanderTemplate == null) 30 | return null; 31 | 32 | var adornerChild = new ContentPresenter 33 | { 34 | ContentTemplate = expanderTemplate, 35 | HorizontalAlignment = HorizontalAlignment.Right, 36 | VerticalAlignment = VerticalAlignment.Center, 37 | Margin = new Thickness(8, 0, 8, 0), 38 | IsHitTestVisible = false, 39 | }; 40 | 41 | if (direction == ListSortDirection.Ascending) 42 | { 43 | adornerChild.RenderTransformOrigin = new Point(0.5, 0.5); 44 | adornerChild.RenderTransform = new ScaleTransform 45 | { 46 | ScaleY = -1, 47 | CenterX = 0.5, 48 | CenterY = 0.5, 49 | }; 50 | } 51 | 52 | return adornerChild; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/SplitButton.cs: -------------------------------------------------------------------------------- 1 | using AdonisUI.Helpers; 2 | using System.Collections.Generic; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Controls.Primitives; 6 | using System.Windows.Media; 7 | 8 | namespace AdonisUI.Controls 9 | { 10 | [TemplatePart(Name = "PART_MenuExpander", Type = typeof(Button))] 11 | public class SplitButton : Button 12 | { 13 | static SplitButton() 14 | { 15 | DefaultStyleKeyProperty.OverrideMetadata(typeof(SplitButton), new FrameworkPropertyMetadata(typeof(SplitButton))); 16 | } 17 | 18 | public static readonly DependencyProperty SplitMenuProperty = DependencyProperty.Register("SplitMenu", typeof(ContextMenu), typeof(SplitButton), new PropertyMetadata(null)); 19 | 20 | public ContextMenu SplitMenu 21 | { 22 | get => (ContextMenu)GetValue(SplitMenuProperty); 23 | set => SetValue(SplitMenuProperty, value); 24 | } 25 | 26 | public override void OnApplyTemplate() 27 | { 28 | base.OnApplyTemplate(); 29 | 30 | if (GetTemplateChild("PART_MenuExpander") is Button menuExpanderButton) 31 | menuExpanderButton.Click += OnMenuExpanderClick; 32 | } 33 | 34 | private void OnMenuExpanderClick(object sender, RoutedEventArgs e) 35 | { 36 | OpenSplitMenu(); 37 | } 38 | 39 | private void OpenSplitMenu() 40 | { 41 | if (SplitMenu == null) 42 | return; 43 | 44 | SplitMenu.IsEnabled = true; 45 | SplitMenu.PlacementTarget = this; 46 | SplitMenu.Placement = PlacementMode.Bottom; 47 | SplitMenu.IsOpen = true; 48 | SplitMenu.Closed += SplitMenu_Closed; 49 | } 50 | 51 | private void SplitMenu_Closed(object sender, RoutedEventArgs e) 52 | { 53 | ResetRippleEffects((FrameworkElement)sender); 54 | } 55 | 56 | private void ResetRippleEffects(FrameworkElement rootElement) 57 | { 58 | foreach (RippleHost rippleHost in UINavigator.FindVisualChildren(rootElement)) 59 | { 60 | rippleHost.Reset(); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/AdonisUI/Controls/ValidationErrorIndicatorPlacement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AdonisUI.Controls 7 | { 8 | public enum ValidationErrorIndicatorPlacement 9 | { 10 | Top, 11 | Bottom, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/AllBoolsToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Data; 8 | 9 | namespace AdonisUI.Converters 10 | { 11 | /// 12 | /// Takes multiple bools as input and returns true if all bools are true. 13 | /// 14 | public class AllBoolsToBoolConverter 15 | : IMultiValueConverter 16 | { 17 | public static AllBoolsToBoolConverter Instance = new AllBoolsToBoolConverter(); 18 | 19 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | return values.OfType().All(x => x); 22 | } 23 | 24 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/AllVisibilitiesToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Windows; 5 | using System.Windows.Data; 6 | 7 | namespace AdonisUI.Converters 8 | { 9 | /// 10 | /// Takes multiple Visibilities as input and returns a single Visibility of the same value if they are all equal 11 | /// or returns Visibility.Visible. 12 | /// 13 | class AllVisibilitiesToVisibilityConverter 14 | : IMultiValueConverter 15 | { 16 | public static AllVisibilitiesToVisibilityConverter Instance = new AllVisibilitiesToVisibilityConverter(); 17 | 18 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | if (values.OfType().All(x => x == Visibility.Collapsed)) 21 | { 22 | return Visibility.Collapsed; 23 | } 24 | 25 | if (values.OfType().All(x => x == Visibility.Hidden)) 26 | { 27 | return Visibility.Hidden; 28 | } 29 | 30 | return Visibility.Visible; 31 | } 32 | 33 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 34 | { 35 | throw new NotImplementedException(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/EqualitityToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace AdonisUI.Converters 10 | { 11 | public class EqualitityToVisibilityConverter 12 | : IValueConverter 13 | , IMultiValueConverter 14 | { 15 | public static EqualitityToVisibilityConverter Instance = new EqualitityToVisibilityConverter(); 16 | 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | bool equals = (bool)EqualityToBoolConverter.Instance.Convert(value, targetType, parameter, culture); 20 | 21 | return equals ? Visibility.Visible : Visibility.Collapsed; 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | 29 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 30 | { 31 | bool equals = (bool)EqualityToBoolConverter.Instance.Convert(values, targetType, parameter, culture); 32 | 33 | if (parameter.ToString().ToLower() == "hidden") 34 | return equals ? Visibility.Visible : Visibility.Hidden; 35 | 36 | return equals ? Visibility.Visible : Visibility.Collapsed; 37 | } 38 | 39 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/EqualityToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Data; 7 | 8 | namespace AdonisUI.Converters 9 | { 10 | public class EqualityToBoolConverter 11 | : IValueConverter 12 | , IMultiValueConverter 13 | { 14 | public static EqualityToBoolConverter Instance = new EqualityToBoolConverter(); 15 | 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | if (value == null && parameter == null) 19 | return true; 20 | 21 | return value != null && value.Equals(parameter); 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | 29 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 30 | { 31 | if (!values.Any()) 32 | return true; 33 | 34 | if (values.All(v => v == null)) 35 | return true; 36 | 37 | object firstValue = values.First(); 38 | 39 | return values.All(v => firstValue.Equals(v)); 40 | } 41 | 42 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 43 | { 44 | throw new NotImplementedException(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/IconToBitmapSourceConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Data; 10 | using System.Windows.Interop; 11 | using System.Windows.Media.Imaging; 12 | 13 | namespace AdonisUI.Converters 14 | { 15 | public class IconToBitmapSourceConverter 16 | : IValueConverter 17 | { 18 | public static IconToBitmapSourceConverter Instance = new IconToBitmapSourceConverter(); 19 | 20 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | if (value == null || value == DependencyProperty.UnsetValue) 23 | return null; 24 | 25 | var icon = (Icon) value; 26 | return Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); 27 | } 28 | 29 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/IsImmutableFilterConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | using System.Windows.Markup; 9 | 10 | namespace AdonisUI.Converters 11 | { 12 | public class IsImmutableFilterConverter 13 | : IValueConverter 14 | { 15 | public static IsImmutableFilterConverter Instance = new IsImmutableFilterConverter(); 16 | 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | if ((bool)IsImmutableToBoolConverter.Instance.Convert(value, targetType, parameter, culture)) 20 | return value; 21 | 22 | return Binding.DoNothing; 23 | } 24 | 25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/IsImmutableToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | using System.Windows.Markup; 9 | 10 | namespace AdonisUI.Converters 11 | { 12 | public class IsImmutableToBoolConverter 13 | : IValueConverter 14 | { 15 | public static IsImmutableToBoolConverter Instance = new IsImmutableToBoolConverter(); 16 | 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | if (value == null) 20 | return true; 21 | 22 | Type type = value.GetType(); 23 | 24 | return type.IsValueType 25 | || type.IsEnum 26 | || value is string 27 | || value is Delegate; 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/IsNullToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Data; 7 | 8 | namespace AdonisUI.Converters 9 | { 10 | public class IsNullToBoolConverter 11 | : IValueConverter 12 | { 13 | public static IsNullToBoolConverter Instance = new IsNullToBoolConverter(); 14 | 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | return value == null; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/RectConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace AdonisUI.Converters 10 | { 11 | public class RectConverter 12 | : IMultiValueConverter 13 | { 14 | public static RectConverter Instance = new RectConverter(); 15 | 16 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | if (values.Length == 0) 19 | return new Rect(); 20 | 21 | if (values.Length == 1 && values[0] is Size) 22 | return new Rect((Size)values[0]); 23 | 24 | if (values.Length == 2 && values[0] is double && values[1] is double) 25 | return new Rect(new Size((double) values[0], (double) values[1])); 26 | 27 | if (values.Length == 2 && values[0] is Point && values[1] is Point) 28 | return new Rect((Point)values[0], (Point)values[1]); 29 | 30 | if (values.Length == 2 && values[0] is Point && values[1] is Size) 31 | return new Rect((Point)values[0], (Size)values[1]); 32 | 33 | if (values.Length == 2 && values[0] is Point && values[1] is Vector) 34 | return new Rect((Point)values[0], (Vector)values[1]); 35 | 36 | if (values.Length == 4 && values[0] is double && values[1] is double && values[2] is double && values[3] is double) 37 | return new Rect((double)values[0], (double)values[1], (double)values[2], (double)values[3]); 38 | 39 | return Binding.DoNothing; 40 | } 41 | 42 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 43 | { 44 | throw new NotImplementedException(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/StringIsNullOrEmptyToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Data; 7 | 8 | namespace AdonisUI.Converters 9 | { 10 | public class StringIsNullOrEmptyToBoolConverter 11 | : IValueConverter 12 | { 13 | public static StringIsNullOrEmptyToBoolConverter Instance = new StringIsNullOrEmptyToBoolConverter(); 14 | 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | return value == null || value.ToString() == String.Empty; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/StringIsNullOrEmptyToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace AdonisUI.Converters 10 | { 11 | public class StringIsNullOrEmptyToVisibilityConverter 12 | : IValueConverter 13 | { 14 | public static StringIsNullOrEmptyToVisibilityConverter Instance = new StringIsNullOrEmptyToVisibilityConverter(); 15 | 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | bool hidden = parameter != null && parameter.ToString() == "hidden"; 19 | 20 | if (value == null || value.ToString() == String.Empty) 21 | return hidden ? Visibility.Hidden : Visibility.Collapsed; 22 | 23 | return Visibility.Visible; 24 | } 25 | 26 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 27 | { 28 | throw new NotImplementedException(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/ThicknessToInverseThicknessConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace AdonisUI.Converters 7 | { 8 | public class ThicknessToInverseThicknessConverter : IValueConverter 9 | { 10 | public static readonly IValueConverter Instance = new ThicknessToInverseThicknessConverter(); 11 | 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | Thickness valueAsThickness = (Thickness)value; 15 | 16 | return new Thickness( 17 | -valueAsThickness.Left, 18 | -valueAsThickness.Top, 19 | -valueAsThickness.Right, 20 | -valueAsThickness.Bottom); 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | return Convert(value, targetType, parameter, culture); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/ValuesToCornerRadiusConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace AdonisUI.Converters 10 | { 11 | public class ValuesToCornerRadiusConverter 12 | : IValueConverter 13 | , IMultiValueConverter 14 | { 15 | public static ValuesToCornerRadiusConverter Instance = new ValuesToCornerRadiusConverter(); 16 | 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | return ConvertToCornerRadius(value); 20 | } 21 | 22 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | if (values.Length == 1) 25 | return ConvertToCornerRadius(values[0]); 26 | 27 | if (values.Length == 2) 28 | return ConvertToCornerRadius(values[0], values[1]); 29 | 30 | if (values.Length == 4) 31 | return ConvertToCornerRadius(values[0], values[1], values[2], values[3]); 32 | 33 | throw new ArgumentException("Invalid amount of values", nameof(values)); 34 | } 35 | 36 | private CornerRadius ConvertToCornerRadius(object uniformValue) 37 | { 38 | double uniformDouble = ToDouble(uniformValue); 39 | return new CornerRadius(uniformDouble); 40 | } 41 | 42 | private CornerRadius ConvertToCornerRadius(object topLeftAndBottomRight, object topRightAndBottomLeft) 43 | { 44 | double topLeftAndBottomRightDouble = ToDouble(topLeftAndBottomRight); 45 | double topRightAndBottomLeftDouble = ToDouble(topRightAndBottomLeft); 46 | 47 | return new CornerRadius(topLeftAndBottomRightDouble, topRightAndBottomLeftDouble, topLeftAndBottomRightDouble, topRightAndBottomLeftDouble); 48 | } 49 | 50 | private CornerRadius ConvertToCornerRadius(object topLeft, object topRight, object bottomRight, object bottomLeft) 51 | { 52 | double topLeftDouble = ToDouble(topLeft); 53 | double topRightDouble = ToDouble(topRight); 54 | double bottomRightDouble = ToDouble(bottomRight); 55 | double bottomLeftDouble = ToDouble(bottomLeft); 56 | 57 | return new CornerRadius(topLeftDouble, topRightDouble, bottomRightDouble, bottomLeftDouble); 58 | } 59 | 60 | private double ToDouble(object value) 61 | { 62 | return value != DependencyProperty.UnsetValue ? System.Convert.ToDouble(value) : 0; 63 | } 64 | 65 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 66 | { 67 | throw new NotImplementedException(); 68 | } 69 | 70 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 71 | { 72 | throw new NotImplementedException(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/ValuesToThicknessConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace AdonisUI.Converters 10 | { 11 | public class ValuesToThicknessConverter 12 | : IValueConverter 13 | , IMultiValueConverter 14 | { 15 | public static ValuesToThicknessConverter Instance = new ValuesToThicknessConverter(); 16 | 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | return ConvertToThickness(value); 20 | } 21 | 22 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | if (values.Length == 1) 25 | return ConvertToThickness(values[0]); 26 | 27 | if (values.Length == 2) 28 | return ConvertToThickness(values[0], values[1]); 29 | 30 | if (values.Length == 4) 31 | return ConvertToThickness(values[0], values[1], values[2], values[3]); 32 | 33 | throw new ArgumentException("Invalid amount of values", nameof(values)); 34 | } 35 | 36 | private Thickness ConvertToThickness(object uniformValue) 37 | { 38 | double uniformDouble = ToDouble(uniformValue); 39 | return new Thickness(uniformDouble); 40 | } 41 | 42 | private Thickness ConvertToThickness(object leftRight, object topBottom) 43 | { 44 | double leftRightDouble = ToDouble(leftRight); 45 | double topBottomDouble = ToDouble(topBottom); 46 | 47 | return new Thickness(leftRightDouble, topBottomDouble, leftRightDouble, topBottomDouble); 48 | } 49 | 50 | private Thickness ConvertToThickness(object left, object top, object right, object bottom) 51 | { 52 | double leftDouble = ToDouble(left); 53 | double topDouble = ToDouble(top); 54 | double rightDouble = ToDouble(right); 55 | double bottomDouble = ToDouble(bottom); 56 | 57 | return new Thickness(leftDouble, topDouble, rightDouble, bottomDouble); 58 | } 59 | 60 | private double ToDouble(object value) 61 | { 62 | return value != DependencyProperty.UnsetValue ? System.Convert.ToDouble(value) : 0; 63 | } 64 | 65 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 66 | { 67 | throw new NotImplementedException(); 68 | } 69 | 70 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 71 | { 72 | throw new NotImplementedException(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/AdonisUI/Converters/VisibilityToInverseVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace AdonisUI.Converters 7 | { 8 | public class VisibilityToInverseVisibilityConverter : IValueConverter 9 | { 10 | public static readonly IValueConverter Instance = new VisibilityToInverseVisibilityConverter(); 11 | 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | Visibility valueAsVisibility = (Visibility)value; 15 | 16 | if (valueAsVisibility == Visibility.Visible) 17 | return "hidden".Equals(parameter) ? Visibility.Hidden : Visibility.Collapsed; 18 | 19 | return Visibility.Visible; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | return Convert(value, targetType, parameter, culture); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/AdonisUI/Dimensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace AdonisUI 9 | { 10 | public static class Dimensions 11 | { 12 | public static ComponentResourceKey CornerRadius => new ComponentResourceKey(typeof(Dimensions), "CornerRadius"); 13 | 14 | public static ComponentResourceKey BorderThickness => new ComponentResourceKey(typeof(Dimensions), "BorderThickness"); 15 | 16 | public static ComponentResourceKey HorizontalSpace => new ComponentResourceKey(typeof(Dimensions), "HorizontalSpace"); 17 | 18 | public static ComponentResourceKey VerticalSpace => new ComponentResourceKey(typeof(Dimensions), "VerticalSpace"); 19 | 20 | public static ComponentResourceKey CursorSpotlightRelativeSize => new ComponentResourceKey(typeof(double), "CursorSpotlightRelativeSize"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/AdonisUI/Extensions/CornerRadiusExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace AdonisUI.Extensions 8 | { 9 | public class CornerRadiusExtension 10 | { 11 | public static CornerRadius GetCornerRadius(DependencyObject obj) 12 | { 13 | return (CornerRadius)obj.GetValue(CornerRadiusProperty); 14 | } 15 | 16 | public static void SetCornerRadius(DependencyObject obj, CornerRadius value) 17 | { 18 | obj.SetValue(CornerRadiusProperty, value); 19 | } 20 | 21 | public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(CornerRadiusExtension), new PropertyMetadata(new CornerRadius(0))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AdonisUI/Extensions/GroupBoxExtension.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.Media; 8 | 9 | namespace AdonisUI.Extensions 10 | { 11 | public class GroupBoxExtension 12 | { 13 | public static Brush GetHeaderBackground(DependencyObject obj) 14 | { 15 | return (Brush)obj.GetValue(HeaderBackgroundProperty); 16 | } 17 | 18 | public static void SetHeaderBackground(DependencyObject obj, Brush value) 19 | { 20 | obj.SetValue(HeaderBackgroundProperty, value); 21 | } 22 | 23 | public static readonly DependencyProperty HeaderBackgroundProperty = DependencyProperty.RegisterAttached("HeaderBackground", typeof(Brush), typeof(GroupBoxExtension), new PropertyMetadata(null)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AdonisUI/Extensions/MenuItemExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace AdonisUI.Extensions 8 | { 9 | public class MenuItemExtension 10 | { 11 | public static DataTemplate GetIconTemplate(DependencyObject obj) 12 | { 13 | return (DataTemplate)obj.GetValue(IconTemplateProperty); 14 | } 15 | 16 | public static void SetIconTemplate(DependencyObject obj, DataTemplate value) 17 | { 18 | obj.SetValue(IconTemplateProperty, value); 19 | } 20 | 21 | public static readonly DependencyProperty IconTemplateProperty = DependencyProperty.RegisterAttached("IconTemplate", typeof(DataTemplate), typeof(MenuItemExtension), new PropertyMetadata(null)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AdonisUI/Extensions/ScrollBarExpansionMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Extensions 8 | { 9 | /// 10 | /// Values for controlling when to expand scroll bars. 11 | /// 12 | public enum ScrollBarExpansionMode 13 | { 14 | /// 15 | /// Never expand the scroll bar. Keep it always collapsed. 16 | /// 17 | NeverExpand, 18 | 19 | /// 20 | /// Expand the scroll bar when the mouse hovers over it. 21 | /// 22 | ExpandOnHover, 23 | 24 | /// 25 | /// Always expand the scroll bar. Do not collapse it. 26 | /// 27 | AlwaysExpand, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI/Extensions/ScrollBarExtension.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.Primitives; 8 | 9 | namespace AdonisUI.Extensions 10 | { 11 | /// 12 | /// Provides attached behaviors related to the ScrollBar control. 13 | /// 14 | public class ScrollBarExtension 15 | { 16 | /// 17 | /// Gets the value of the attached property of the specified ScrollBar. 18 | /// 19 | [AttachedPropertyBrowsableForType(typeof(ScrollBar))] 20 | public static ScrollBarExpansionMode GetExpansionMode(DependencyObject obj) 21 | { 22 | return (ScrollBarExpansionMode)obj.GetValue(ExpansionModeProperty); 23 | } 24 | 25 | /// 26 | /// Sets the value of the attached property of the specified ScrollBar. 27 | /// 28 | public static void SetExpansionMode(DependencyObject obj, ScrollBarExpansionMode value) 29 | { 30 | obj.SetValue(ExpansionModeProperty, value); 31 | } 32 | 33 | /// 34 | /// A DependencyProperty that controls when to expand and collapse the scroll bar. 35 | /// 36 | public static readonly DependencyProperty ExpansionModeProperty = DependencyProperty.RegisterAttached("ExpansionMode", typeof(ScrollBarExpansionMode), typeof(ScrollBarExtension), new PropertyMetadata(ScrollBarExpansionMode.ExpandOnHover)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/AdonisUI/Extensions/ScrollBarPlacement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Extensions 8 | { 9 | /// 10 | /// Values for controlling the placement of scroll bars. 11 | /// 12 | public enum ScrollBarPlacement 13 | { 14 | /// 15 | /// Place the scroll bar next to content (default). 16 | /// 17 | Docked, 18 | 19 | /// 20 | /// Place the scroll bar on top of content. 21 | /// 22 | Overlay, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/AdonisUI/Extensions/ValidationExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using AdonisUI.Controls; 7 | 8 | namespace AdonisUI.Extensions 9 | { 10 | public class ValidationExtension 11 | { 12 | public static bool GetIsErrorMessageVisibleOnFocus(DependencyObject obj) 13 | { 14 | return (bool)obj.GetValue(IsErrorMessageVisibleOnFocusProperty); 15 | } 16 | 17 | public static void SetIsErrorMessageVisibleOnFocus(DependencyObject obj, bool value) 18 | { 19 | obj.SetValue(IsErrorMessageVisibleOnFocusProperty, value); 20 | } 21 | 22 | public static bool GetIsErrorMessageVisibleOnMouseOver(DependencyObject obj) 23 | { 24 | return (bool)obj.GetValue(IsErrorMessageVisibleOnMouseOverProperty); 25 | } 26 | 27 | public static void SetIsErrorMessageVisibleOnMouseOver(DependencyObject obj, bool value) 28 | { 29 | obj.SetValue(IsErrorMessageVisibleOnMouseOverProperty, value); 30 | } 31 | 32 | public static ValidationErrorIndicatorPlacement GetErrorMessagePlacement(DependencyObject obj) 33 | { 34 | return (ValidationErrorIndicatorPlacement)obj.GetValue(ErrorMessagePlacementProperty); 35 | } 36 | 37 | public static void SetErrorMessagePlacement(DependencyObject obj, ValidationErrorIndicatorPlacement value) 38 | { 39 | obj.SetValue(ErrorMessagePlacementProperty, value); 40 | } 41 | 42 | public static readonly DependencyProperty IsErrorMessageVisibleOnFocusProperty = DependencyProperty.RegisterAttached("IsErrorMessageVisibleOnFocus", typeof(bool), typeof(ValidationExtension), new PropertyMetadata(true)); 43 | 44 | public static readonly DependencyProperty IsErrorMessageVisibleOnMouseOverProperty = DependencyProperty.RegisterAttached("IsErrorMessageVisibleOnMouseOver", typeof(bool), typeof(ValidationExtension), new PropertyMetadata(true)); 45 | 46 | public static readonly DependencyProperty ErrorMessagePlacementProperty = DependencyProperty.RegisterAttached("ErrorMessagePlacement", typeof(ValidationErrorIndicatorPlacement), typeof(ValidationExtension), new PropertyMetadata(ValidationErrorIndicatorPlacement.Top)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/AdonisUI/Helpers/HwndInteropPositionChangingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Helpers 8 | { 9 | public class HwndInteropPositionChangingEventArgs 10 | : EventArgs 11 | { 12 | public enum PositionChangeType 13 | { 14 | /// 15 | /// Draws a frame (defined in the window's class description) around the window. Same as the flag. 16 | /// 17 | DRAWFRAME = 0x0020, 18 | 19 | /// 20 | /// Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. 21 | /// 22 | FRAMECHANGED = DRAWFRAME, 23 | 24 | /// 25 | /// Hides the window. 26 | /// 27 | HIDEWINDOW = 0x0080, 28 | 29 | /// 30 | /// Does not activate the window. 31 | /// 32 | NOACTIVATE = 0x0010, 33 | 34 | /// 35 | /// Discards the entire contents of the client area. 36 | /// 37 | NOCOPYBITS = 0x0100, 38 | 39 | /// 40 | /// Retains the current position (ignores the x and y members). 41 | /// 42 | NOMOVE = 0x0002, 43 | 44 | /// 45 | /// Does not change the owner window's position in the Z order. 46 | /// 47 | NOOWNERZORDER = 0x0200, 48 | 49 | /// 50 | /// Does not redraw changes. 51 | /// 52 | SWP_NOREDRAW = 0x0008, 53 | 54 | /// 55 | /// Does not change the owner window's position in the Z order. Same as the flag. 56 | /// 57 | NOREPOSITION = NOOWNERZORDER, 58 | 59 | /// 60 | /// Prevents the window from receiving the WM_WINDOWPOSCHANGING message. 61 | /// 62 | NOSENDCHANGING = 0x0400, 63 | 64 | /// 65 | /// Retains the current size (ignores the cx and cy members). 66 | /// 67 | NOSIZE = 0x0001, 68 | 69 | /// 70 | /// Retains the current Z order (ignores the hwndInsertAfter member). 71 | /// 72 | NOZORDER = 0x0004, 73 | 74 | /// 75 | /// Displays the window. 76 | /// 77 | SHOWWINDOW = 0x0040, 78 | 79 | /// 80 | /// No official documentation found. Seems to occur whe maximizing or restoring a window. 81 | /// 82 | MAXIMIZERESTORE = 0x8020, 83 | } 84 | 85 | public PositionChangeType Type { get; private set; } 86 | 87 | public HwndInteropPositionChangingEventArgs(PositionChangeType positionChangeType) 88 | { 89 | Type = positionChangeType; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/AdonisUI/Helpers/HwndInteropSizeChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AdonisUI.Helpers 8 | { 9 | public class HwndInteropSizeChangedEventArgs 10 | : EventArgs 11 | { 12 | /// 13 | /// The type of resizing requested. 14 | /// 15 | public enum ResizeRequestType 16 | { 17 | /// 18 | /// The window has been resized, but neither the nor value applies. 19 | /// 20 | Restored = 0, 21 | 22 | /// 23 | /// The window has been minimized. 24 | 25 | /// 26 | Minimized = 1, 27 | 28 | /// 29 | /// The window has been maximized. 30 | /// 31 | Maximized = 2, 32 | 33 | /// 34 | /// Message is sent to all pop-up windows when some other window has been restored to its former size. 35 | /// 36 | MaxShow = 3, 37 | 38 | /// 39 | /// Message is sent to all pop-up windows when some other window is maximized. 40 | /// 41 | MaxHide = 4, 42 | } 43 | 44 | /// 45 | /// The type of resizing requested. 46 | /// 47 | public ResizeRequestType Type { get; private set; } 48 | 49 | public HwndInteropSizeChangedEventArgs(ResizeRequestType resizeRequestType) 50 | { 51 | Type = resizeRequestType; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/AdonisUI/Helpers/ResourceAliasExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Markup; 9 | using System.Xaml; 10 | 11 | namespace AdonisUI.Helpers 12 | { 13 | internal class ResourceAliasExtension 14 | : MarkupExtension 15 | { 16 | public object ResourceKey { get; set; } 17 | 18 | public override object ProvideValue(IServiceProvider serviceProvider) 19 | { 20 | IRootObjectProvider rootObjectProvider = (IRootObjectProvider)serviceProvider.GetService(typeof(IRootObjectProvider)); 21 | IDictionary dictionary = rootObjectProvider?.RootObject as IDictionary; 22 | return dictionary?[ResourceKey]; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AdonisUI/Helpers/SystemContextMenuInterop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | using System.Windows.Interop; 5 | 6 | namespace AdonisUI.Helpers 7 | { 8 | /// 9 | /// Helper class for interactions with the system's native context menu 10 | /// 11 | internal static class SystemContextMenuInterop 12 | { 13 | public static uint TPM_LEFTALIGN = 0; 14 | 15 | public static uint TPM_RETURNCMD = 256; 16 | 17 | [DllImport("user32.dll", CharSet = CharSet.None, ExactSpelling = false)] 18 | public static extern IntPtr PostMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); 19 | 20 | [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = false, SetLastError = true)] 21 | public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); 22 | 23 | [DllImport("user32.dll", CharSet = CharSet.None, ExactSpelling = false)] 24 | public static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem, uint uEnable); 25 | 26 | [DllImport("user32.dll", CharSet = CharSet.None, ExactSpelling = false)] 27 | public static extern int TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm); 28 | 29 | public static void OpenSystemContextMenu(Window window, Point positionInWindow) 30 | { 31 | Point screenCoordinate = window.PointToScreen(positionInWindow); 32 | IntPtr windowHandle = new WindowInteropHelper(window).Handle; 33 | IntPtr systemMenu = GetSystemMenu(windowHandle, false); 34 | 35 | int track = TrackPopupMenuEx( 36 | systemMenu, 37 | TPM_LEFTALIGN | TPM_RETURNCMD, 38 | Convert.ToInt32(screenCoordinate.X), 39 | Convert.ToInt32(screenCoordinate.Y), 40 | windowHandle, 41 | IntPtr.Zero); 42 | 43 | if (track == 0) 44 | return; 45 | 46 | PostMessage(windowHandle, 274, new IntPtr(track), IntPtr.Zero); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/AdonisUI/Helpers/UINavigator.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.Media; 8 | 9 | namespace AdonisUI.Helpers 10 | { 11 | public class UINavigator 12 | { 13 | public static T FindVisualChild(DependencyObject depObj) where T : DependencyObject 14 | { 15 | return FindVisualChildren(depObj).FirstOrDefault(); 16 | } 17 | 18 | public static T FindVisualChild(DependencyObject depObj, string name) where T : DependencyObject 19 | { 20 | return FindVisualChildren(depObj).OfType().FirstOrDefault(x => x.Name == name) as T; 21 | } 22 | 23 | public static IEnumerable FindVisualChildren(DependencyObject depObj) where T : DependencyObject 24 | { 25 | if (depObj == null) 26 | yield break; 27 | 28 | for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) 29 | { 30 | DependencyObject child = VisualTreeHelper.GetChild(depObj, i); 31 | if (child is T variable) 32 | yield return variable; 33 | 34 | foreach (T childOfChild in FindVisualChildren(child)) 35 | yield return childOfChild; 36 | } 37 | } 38 | 39 | public static T FindVisualParent(DependencyObject current) where T : DependencyObject 40 | { 41 | current = VisualTreeHelper.GetParent(current); 42 | 43 | while (current != null) 44 | { 45 | if (current is T) 46 | return (T)current; 47 | 48 | current = VisualTreeHelper.GetParent(current); 49 | }; 50 | 51 | return null; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/AdonisUI/Icons.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace AdonisUI 8 | { 9 | public static class Icons 10 | { 11 | public static ComponentResourceKey AdonisUI => new ComponentResourceKey(typeof(Icons), "AdonisUI"); 12 | 13 | public static ComponentResourceKey AdonisUIFull => new ComponentResourceKey(typeof(Icons), "AdonisUIFull"); 14 | 15 | public static ComponentResourceKey AdonisUIGrayscale => new ComponentResourceKey(typeof(Icons), "AdonisUIGrayscale"); 16 | 17 | public static ComponentResourceKey AdonisUIDarkFull => new ComponentResourceKey(typeof(Icons), "AdonisUIDarkFull"); 18 | 19 | public static ComponentResourceKey Error => new ComponentResourceKey(typeof(Icons), "Error"); 20 | 21 | public static ComponentResourceKey WindowMinimize => new ComponentResourceKey(typeof(Icons), "WindowMinimize"); 22 | 23 | public static ComponentResourceKey WindowMaximize => new ComponentResourceKey(typeof(Icons), "WindowMaximize"); 24 | 25 | public static ComponentResourceKey WindowRestore => new ComponentResourceKey(typeof(Icons), "WindowRestore"); 26 | 27 | public static ComponentResourceKey WindowClose => new ComponentResourceKey(typeof(Icons), "WindowClose"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AdonisUI/Styles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace AdonisUI 9 | { 10 | public static class Styles 11 | { 12 | public static ComponentResourceKey AccentButton => new ComponentResourceKey(typeof(Styles), "AccentButton"); 13 | 14 | public static ComponentResourceKey ToolbarButton => new ComponentResourceKey(typeof(Styles), "ToolbarButton"); 15 | 16 | public static ComponentResourceKey AccentToolbarButton => new ComponentResourceKey(typeof(Styles), "AccentToolbarButton"); 17 | 18 | public static ComponentResourceKey ToolbarToggleButton => new ComponentResourceKey(typeof(Styles), "ToolbarToggleButton"); 19 | 20 | public static ComponentResourceKey DefaultToAccentToggleButton => new ComponentResourceKey(typeof(Styles), "DefaultToAccentToggleButton"); 21 | 22 | public static ComponentResourceKey AccentComboBox => new ComponentResourceKey(typeof(Styles), "AccentComboBox"); 23 | 24 | public static ComponentResourceKey AccentComboBoxItem => new ComponentResourceKey(typeof(Styles), "AccentComboBoxItem"); 25 | 26 | public static ComponentResourceKey WindowButton => new ComponentResourceKey(typeof(Styles), "WindowButton"); 27 | 28 | public static ComponentResourceKey WindowCloseButton => new ComponentResourceKey(typeof(Styles), "WindowCloseButton"); 29 | 30 | public static ComponentResourceKey WindowToggleButton => new ComponentResourceKey(typeof(Styles), "WindowToggleButton"); 31 | 32 | public static ComponentResourceKey RippleListBoxItem => new ComponentResourceKey(typeof(Styles), "RippleListBoxItem"); 33 | 34 | public static ComponentResourceKey SelectableTextBlockTextBox => new ComponentResourceKey(typeof(Styles), "SelectableTextBlockTextBox"); 35 | 36 | public static ComponentResourceKey ToggleSwitch => new ComponentResourceKey(typeof(Styles), "ToggleSwitch"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/AdonisUI/Templates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace AdonisUI 8 | { 9 | public static class Templates 10 | { 11 | public static ComponentResourceKey ValidationErrorTemplate => new ComponentResourceKey(typeof(Templates), "ValidationErrorTemplate"); 12 | 13 | public static ComponentResourceKey Expander => new ComponentResourceKey(typeof(Templates), "Expander"); 14 | 15 | public static ComponentResourceKey LoadingCircle => new ComponentResourceKey(typeof(Templates), "LoadingCircle"); 16 | 17 | public static ComponentResourceKey LoadingBars => new ComponentResourceKey(typeof(Templates), "LoadingBars"); 18 | 19 | public static ComponentResourceKey LoadingDots => new ComponentResourceKey(typeof(Templates), "LoadingDots"); 20 | 21 | public static ComponentResourceKey DatePickerDropDownButton => new ComponentResourceKey(typeof(Templates), "DatePickerDropDownButton"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AdonisUI/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/AdonisUI/Themes/Themes.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, 5 | ResourceDictionaryLocation.SourceAssembly 6 | )] 7 | -------------------------------------------------------------------------------- /src/AdonisUI/ViewModels/PropertyChangedBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Runtime.CompilerServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AdonisUI.ViewModels 10 | { 11 | /// 12 | /// 13 | /// Notifies clients that a property value is changing or has changed. 14 | /// It includes methods to set the value of a property and automatically raise events on the appropriate event handlers. 15 | /// 16 | public class PropertyChangedBase 17 | : INotifyPropertyChanged 18 | { 19 | /// 20 | public event PropertyChangedEventHandler PropertyChanged; 21 | 22 | /// 23 | /// Raise an event on to indicate that a property value changed. 24 | /// 25 | /// Name of the changed property value. 26 | protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = null) 27 | { 28 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 29 | } 30 | 31 | /// 32 | /// 33 | /// Set to the given . 34 | /// 35 | /// 36 | /// If the given is different than the current value, 37 | /// it raises an event on after the storage was changed. 38 | /// 39 | /// 40 | /// The type of the value to set. 41 | /// Reference to the storage field. 42 | /// New value to set. 43 | /// Name of the property. 44 | /// if the value was different from the variable and an event on was raised; otherwise, . 45 | protected virtual bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) 46 | { 47 | if (EqualityComparer.Default.Equals(storage, value)) 48 | return false; 49 | 50 | storage = value; 51 | NotifyPropertyChanged(propertyName); 52 | return true; 53 | } 54 | } 55 | } 56 | --------------------------------------------------------------------------------