...
 
Commits (81)
    https://gitcode.net/jobily/wpfui/-/commit/d027159a470731e1a1c0b72e1309e2066eaa506b update : TopCompactNavigationViewItemTemplate Add SubMenuPopup Add subMenu Icon 2023-05-26T09:44:36+08:00 zh3305 zh3305@gmail.com https://gitcode.net/jobily/wpfui/-/commit/ae82cda285e0e8409e33ca9ef0c95745d0bb0f9b Removed unused code in TextBox control 2023-06-14T21:35:39+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/c4133037fd587dcdd2a3cae6f8050e33e7ea2d4b Update ExpanderPage.xaml 2023-06-14T21:52:15+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/2f5fbc592ad4da1bb2210a1534b57e3b9587012d Update FluentWindow.xaml 2023-06-14T21:52:26+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/f028eace52ec412374d1f14d51b6268bb3702b39 Update MultilevelNavigationSamplePage3.xaml 2023-06-15T09:03:39+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/c12dcae86ea3f6db19865d97d70408e13a23cc33 Fixed TitleBar header 2023-06-16T20:09:52+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/109e37cb3f5e71b07df6fa1baf5154200d16d609 Merge pull request #661 from IvanDmitriev1/TitleBar-fix 2023-06-16T18:37:44+00:00 pomian kontakt@rapiddev.pl TitleBar header fix https://gitcode.net/jobily/wpfui/-/commit/1483f5417fb132a44d5a07349e6195ac8968b7d7 Merge pull request #659 from IvanDmitriev1/fixes 2023-06-16T18:39:07+00:00 pomian kontakt@rapiddev.pl Textbox control update, small other changes. https://gitcode.net/jobily/wpfui/-/commit/30fd414dd6411e09e5aae87f41d24ada97d9f508 Update docs 2023-06-16T21:26:53+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/1a45d86f7c91ba5ff4083af6a119d3ccc4eb8d06 Update chevron 2023-06-16T21:27:24+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/8a913a419cee478c610363eb66aab0684e8a0d79 Update cache 2023-06-16T21:27:32+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/69bea5a67ca9e19aeda791c3fb2f4ee24d5b25be Update workflow 2023-06-16T21:28:32+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/0d247957bb5cafeaf852ffacadcfd47509ae3033 Merge branch 'main' of https://github.com/lepoco/wpfui into development 2023-06-19T20:06:21+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/8ac812afdb2fb6539eccb316d8aa5e62fc7c56ee Keep one Controls namespace 2023-06-19T21:48:54+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/c1b6f49b6f3ef010e0d749d79cc9f958d39ca0ee Smash project with csharpier 2023-06-21T20:52:35+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/ec080356fc853b7c5f0f13c0453751d98c5f14e3 Fix PasswordBox reveal button 2023-06-27T21:21:04+03:00 Nice3point nice3point@gmail.com https://gitcode.net/jobily/wpfui/-/commit/ad707052ba4573fafa359f457c2ce4fc831dc99e Merge pull request #671 from Nice3point/development 2023-06-27T19:04:26+00:00 pomian kontakt@rapiddev.pl Fix PasswordBox reveal button https://gitcode.net/jobily/wpfui/-/commit/c37619da6d5c521c642e4b0bc3bc70e3c5baebc7 Merge branch 'development' into NavigationViewItem_Style_Change 2023-06-27T19:07:23+00:00 pomian kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/2054cc348117e058e9ac6d79bd7d4e399da2581b Refactor gallery page detection 2023-06-27T23:01:39+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/1958de544a2848e6a67a05983ba1c15364404f73 Ignore vscode 2023-06-27T23:05:18+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/718ed56be16b734255aeabde11f6130704d4fc30 Ignore vscode 2023-06-27T23:06:41+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/8cc624c67aab67b7882fd164ba678d0e9fd7393b ComboBox 2023-06-28T13:57:37+02:00 Niels Laute niels.laute@live.nl https://gitcode.net/jobily/wpfui/-/commit/084e0a9cab7bcba9b13ba3790ca3c950d834f108 Update ToolTip.xaml 2023-06-28T14:04:08+02:00 Niels Laute niels.laute@live.nl https://gitcode.net/jobily/wpfui/-/commit/36b75b027f6b5c64b53b57e605250ba1c241966a AutoSuggestBox 2023-06-28T14:06:22+02:00 Niels Laute niels.laute@live.nl https://gitcode.net/jobily/wpfui/-/commit/6c984351e0913811d762c263684e3b7385dc61c4 Flyout 2023-06-28T14:06:29+02:00 Niels Laute niels.laute@live.nl https://gitcode.net/jobily/wpfui/-/commit/c0ebbad6f9a80adb78c8a0fad6f244b72ae178c4 Update TitleBar.xaml 2023-06-28T14:39:37+02:00 Niels Laute niels.laute@live.nl https://gitcode.net/jobily/wpfui/-/commit/441c85aa4e1b7238a61995edf1abfadafc01ecea Update InfoBar.xaml 2023-06-28T16:29:09+02:00 Niels Laute niels.laute@live.nl https://gitcode.net/jobily/wpfui/-/commit/9c54e4f7d32d73471eb1a08e9e7ce930485a8d8d Adding events 2023-06-28T16:45:11+02:00 Niels Laute niels.laute@live.nl https://gitcode.net/jobily/wpfui/-/commit/328f9cb37052438a678a5f29695a15338f8c1f8b Fixed #683 2023-06-29T10:49:08+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/24e782e94f44b128c195096b76311c70b616e000 Added multi-line TextBox example 2023-06-29T10:51:50+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/9aa0a31618083e6e0a9c7626bcb482920464e247 Added PageControlDocumentation 2023-06-29T11:35:08+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/a030cb9091eea6e5b6a9f882c4515019b7efd1a1 Added Navigated event 2023-06-29T11:52:21+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/0028b0592cb9a54919f8f7199aeed404532802d3 Implemented PageControlDocumentation 2023-06-29T13:36:12+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/a4632b7e1f8f4d156c7ef836311e9ba3e1d279a5 [bugfix] Update `GalleryNavigationPresenter.xaml` to fix issues #685 2023-06-29T16:19:15+08:00 Jeremy Wu 54832272+JeremyWu917@users.noreply.github.com Update `GalleryNavigationPresenter.xaml` to fix issues #685 https://gitcode.net/jobily/wpfui/-/commit/5aaf684085b4f56c034b5d361cb4f7fe0da2c367 Merge pull request #686 from JeremyWu917/JeremyWu917-patch-1 2023-06-30T07:50:08+00:00 pomian kontakt@rapiddev.pl [bugfix] Update `GalleryNavigationPresenter.xaml` to fix issues #685 https://gitcode.net/jobily/wpfui/-/commit/e98b002e2a2593ad96284741577cd5d056440bb2 Merge pull request #684 from IvanDmitriev1/TextBox-update 2023-06-30T07:51:20+00:00 pomian kontakt@rapiddev.pl TextBox multi-line fix https://gitcode.net/jobily/wpfui/-/commit/50646c9195ce19eb8e95638bf107dd1525ff80c2 Merge pull request #645 from zh3305/NavigationViewItem_Style_Change 2023-06-30T07:53:42+00:00 pomian kontakt@rapiddev.pl update : TopCompactNavigationViewItemTemplate Add SubMenuPopup Add su… https://gitcode.net/jobily/wpfui/-/commit/8d459f441f8417a421ea80e8654ba42bb5a510dc Merge pull request #678 from niels9001/niels9001/togglebutton-fix 2023-06-30T07:54:41+00:00 pomian kontakt@rapiddev.pl TitleBar tweaks https://gitcode.net/jobily/wpfui/-/commit/23cc5e744ea0b8be745427f09e10103ca2249cbf Merge pull request #676 from niels9001/niels9001/flyout-fixes 2023-06-30T07:55:20+00:00 pomian kontakt@rapiddev.pl Improving flyout styling https://gitcode.net/jobily/wpfui/-/commit/d379719b782b2d31f1489b2196ef380c629c4f92 Fix namespace in `NavigationView` 2023-06-30T10:01:37+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/289ec6d6e08ec4974de739c835a63e41325247d4 Merge branch 'development' into New-documantation-control 2023-06-30T18:04:37+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/3c8e3f434a0cce14a1d5df77cb1bfafa8278e613 Updated BasicInput pages 2023-06-30T18:55:24+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/85910dbecd820110c7cc0987352656324b90c717 Updated Collections pages 2023-06-30T19:02:44+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/e6bc51c451c579a2d2214e73be8a422588df45c4 Updated Media, DialogsAndFlyouts, DateAndTime pages 2023-06-30T19:16:22+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/726ba560e58543f3a51cb05a95be23b49d100828 Updated Navigation, Text, StatusAndInfo pages 2023-06-30T19:36:37+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/75e559dbe6ddfb3c14c34b3b04da94e4d2c23ac0 Deleted GalleryControlPresenter and ControlDocumentationSummary 2023-06-30T19:41:36+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/d288c113bd835f3caecdb9dbf534851b00660cb2 Style fixes 2023-06-30T19:51:18+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/b0662357eac9aaeebefc923ea7d8089df3e50ca1 Update MainWindow.xaml 2023-06-30T20:01:33+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/fce5768040d294c82d16c9760c6ab14a4a1e776c Fixed navigation item style 2023-07-01T08:37:48+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/742bf9203512eb058a1b1a67812a767ec01e515c Deleted unused converters 2023-07-01T08:38:12+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/a8e27dafb457990f37544be424e5b7f878a50970 Added font size parameter to the constructor 2023-07-01T08:39:05+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/ac52b51d53264597ca5870ac9b8b4c287de61dba Update NavigationView.xaml 2023-07-01T08:48:30+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/a3792d1f9c8cdbae712de367f0c03797adac257b Separated navigation view styles into separate files 2023-07-01T09:39:26+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/31b06878c9a8202ad29329bd595d079ef32c27ce Merge pull request #689 from IvanDmitriev1/Navigation-view-item-fix 2023-07-01T10:10:21+00:00 pomian kontakt@rapiddev.pl NavigationViewItem style fix https://gitcode.net/jobily/wpfui/-/commit/9cbb35b398840bc58357b2bacbdfd87f46794fdd Merge pull request #688 from IvanDmitriev1/New-documantation-control 2023-07-01T10:18:09+00:00 pomian kontakt@rapiddev.pl PageControlDocumentation control https://gitcode.net/jobily/wpfui/-/commit/41d02b90d8d07796d64bf7eea0663f246e23ff9f Merge branch 'development' into niels9001/flyout-events 2023-07-01T10:19:57+00:00 pomian kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/7addd9e167165751f16b7e5500ba44f43528de06 Merge pull request #682 from niels9001/niels9001/flyout-events 2023-07-01T10:20:18+00:00 pomian kontakt@rapiddev.pl [Flyout] Adding Opened and Closed events https://gitcode.net/jobily/wpfui/-/commit/81f408e763fa6f95d3081c5e698242dd3bdeedac Merge branch 'development' into niels9001/infobar 2023-07-01T10:20:48+00:00 pomian kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/e198dcb2d6a385e8f0caa8ec4f4978e43bd0d267 Merge pull request #681 from niels9001/niels9001/infobar 2023-07-01T10:21:04+00:00 pomian kontakt@rapiddev.pl Improved InfoBar styling https://gitcode.net/jobily/wpfui/-/commit/ec0389cdceb73764da490435e4af1f207ae75f24 Fix Windows presenter in Gallery 2023-07-01T20:59:10+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/5bf7682246052654bd5afec5803b348c81c3592d Format with csharpier 2023-07-01T21:00:37+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/21292029e42d704fcf2f8d5e072931941f537053 Update FontIcon.cs 2023-07-04T14:59:11+06:00 Ivan Dmitriev 42055372+IvanDmitriev1@users.noreply.github.com https://gitcode.net/jobily/wpfui/-/commit/0d8dd9cb0d6f5ca79ad5c092570d1bad09235809 Merge pull request #695 from IvanDmitriev1/mistake-correction 2023-07-04T15:28:28+00:00 pomian kontakt@rapiddev.pl Mistake correction https://gitcode.net/jobily/wpfui/-/commit/6d0f450bc651d821b596b0b27410137bb853b1a2 Ignore IntelliJ IDEA files 2023-07-04T18:58:40+03:00 Nice3point nice3point@gmail.com https://gitcode.net/jobily/wpfui/-/commit/e2b53bfbae7d21ed97c15d4360310fe7a3b90e21 Merge pull request #696 from Nice3point/development_ignore 2023-07-07T07:45:19+00:00 pomian kontakt@rapiddev.pl Ignore IntelliJ IDEA files https://gitcode.net/jobily/wpfui/-/commit/3c43f26beb05127a49ad1115bbe8dcf4bb5964ea Update controls example borders 2023-07-08T12:58:49+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/54a41873513c974d8e903fb53eb5ce856340e989 Update editor configs 2023-07-08T12:59:00+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/b092efdbaba14f2095cbe57aeaa92a19bb791a93 Fix card expander animation and corners 2023-07-08T12:59:26+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/79b0952de508864398c8746bfd03944a7067fbe4 Add missing keys to theme resource 2023-07-08T12:59:42+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/f5b7cd2c6add341dfa626a752143e89c92f30caf Fix virtualized rendering for sample apps 2023-07-08T12:59:52+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/a8cb48fe7bd881ea2f4dcf8e56b3a36f358ca7f0 Use binding for expander corners 2023-07-08T13:00:10+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/b81a73923f3e4d0e41211c354d4dc75770d89b58 Remove size from fluent template 2023-07-08T13:00:40+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/8405e07b702a594dd55a035061f6045c480e28fb Use singletons for dashboard pages 2023-07-08T13:00:52+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/d57a7075558a38e6f8dc8a70dc0f9a87208c241f Refactor page control presentation and move actions to visual buttons 2023-07-08T13:01:17+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/227801a2fd71650eaadc178bf71b01b7559de5ad Update icons size for navigation presenter 2023-07-08T13:01:34+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/837b021e6eaf546daae3d14bfe6d31d97588fb78 Remove default padding from Gallery pages 2023-07-08T13:01:56+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/ac7fd43675ec91a5d65eceb5848303c6f78e36be Refactor Icons, update Typography and add sample page for Colors 2023-07-08T13:02:27+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/288abc229c870f07767f4a429fa594779ca19aeb Update file header editorconfig 2023-07-08T13:10:52+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/78bbc4a269a14d834fe9571afea7ee44b74abbcc Update gallery navigation 2023-07-08T23:17:23+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/f207baa01644b059a3b2319bc0d47213eaa1767d Bump version 2023-07-08T23:17:56+02:00 pomianowski kontakt@rapiddev.pl https://gitcode.net/jobily/wpfui/-/commit/35840237797de317d57e6b3be4039db46e13760f Merge pull request #701 from lepoco/development 2023-07-08T21:22:06+00:00 pomian kontakt@rapiddev.pl Merge development branch
此差异已折叠。
......@@ -6,65 +6,20 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
target-branch: "development"
directory: "/"
schedule:
interval: "daily"
labels:
- "Actions"
# Maintain dependencies for nuget
- package-ecosystem: "nuget"
target-branch: "development"
directory: "src/Wpf.Ui"
schedule:
interval: "daily"
labels:
- "NuGet"
# Maintain dependencies for nuget
- package-ecosystem: "nuget"
target-branch: "development"
directory: "src/Wpf.Ui.Demo/"
schedule:
interval: "daily"
labels:
- "NuGet"
# Maintain dependencies for nuget
- package-ecosystem: "nuget"
target-branch: "development"
directory: "src/Wpf.Ui.SimpleDemo/"
schedule:
interval: "daily"
labels:
- "NuGet"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
target-branch: "development"
directory: "/"
schedule:
interval: "daily"
labels:
- "Actions"
# Maintain dependencies for nuget
- package-ecosystem: "nuget"
target-branch: "development"
directory: "src/Wpf.Ui.FontMapper/"
schedule:
interval: "daily"
labels:
- "NuGet"
# Maintain dependencies for nuget
- package-ecosystem: "nuget"
target-branch: "development"
directory: "src/Wpf.Ui.Extension/Wpf.Ui.Extension/"
schedule:
interval: "daily"
labels:
- "NuGet"
# Maintain dependencies for nuget
- package-ecosystem: "npm"
target-branch: "development"
directory: "branding/"
schedule:
interval: "daily"
labels:
- "icons"
- package-ecosystem: "nuget"
target-branch: "development"
directory: "src"
schedule:
interval: "daily"
labels:
- "NuGet"
name: wpfui-docs
on:
push:
branches: [main]
workflow_dispatch:
jobs:
publish_docs:
runs-on: ubuntu-latest
steps:
- name: Chekout
uses: actions/checkout@v3
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
- run: dotnet tool update -g docfx
- run: docfx docs/docfx.json
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
name: wpfui-docs
on:
push:
branches: [main]
paths:
- "docs/"
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- uses: nikeee/docfx-action@v1.0.0
name: Build Documentation
with:
args: docs/docfx.json
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: docs/_site/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
......@@ -15,6 +15,12 @@ docs/api/
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Visual Studio Code files
.vscode
# IntelliJ IDEA files
.idea
# Mono auto generated files
mono_crash.*
......
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.NetCore.Component.Runtime.6.0",
"Microsoft.NetCore.Component.SDK",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.ComponentGroup.ClickOnce.Publish",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.Net.Component.4.8.SDK",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.Component.ClickOnce",
"Microsoft.VisualStudio.Component.ManagedDesktop.Core",
"Microsoft.Net.Component.4.8.TargetingPack",
"Microsoft.Net.Component.4.7.TargetingPack",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.VisualStudio.Component.PortableLibrary",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.Net.ComponentGroup.TargetingPacks.Common",
"Microsoft.Component.CodeAnalysis.SDK",
"Microsoft.Net.Component.4.6.TargetingPack",
"Microsoft.NetCore.Component.Runtime.3.1",
"Microsoft.NetCore.Component.Runtime.5.0",
"Microsoft.Net.Component.4.6.1.TargetingPack"
]
"version": "1.0",
"components": [
"Microsoft.Component.ClickOnce",
"Microsoft.Component.CodeAnalysis.SDK",
"Microsoft.Component.MSBuild",
"Microsoft.ComponentGroup.ClickOnce.Publish",
"Microsoft.Net.Component.4.6.2.TargetingPack",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.Net.Component.4.8.1.TargetingPack",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.Net.ComponentGroup.TargetingPacks.Common",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.NetCore.Component.Runtime.6.0",
"Microsoft.NetCore.Component.Runtime.7.0",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.ManagedDesktop.Core",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.PortableLibrary",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.VisualStudio.Workload.ManagedDesktop"
]
}
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>3.0.0-preview.3</Version>
<Version>3.0.0-preview.4</Version>
<LangVersion>11.0</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditLevel>moderate</NuGetAuditLevel>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
......@@ -14,7 +16,7 @@
<PropertyGroup>
<Authors>lepo.co</Authors>
<Company>lepo.co</Company>
<Copyright>Copyright (C) 2021-2022 Leszek Pomianowski and WPF UI Contributors</Copyright>
<Copyright>Copyright (C) 2021-2023 Leszek Pomianowski and WPF UI Contributors</Copyright>
</PropertyGroup>
<PropertyGroup>
......
......@@ -26,7 +26,7 @@ https://pomagamukrainie.gov.pl/chce-pomoc/prywatnie/pomoc-finansowa
For a starter guide see our [documentation](https://wpfui.lepo.co/documentation/).
**WPF UI Gallery** is a free application available in the _Microsoft Store_, with which you can test all functionalities.
https://apps.microsoft.com/store/detail/wpf-ui/9N9LKV8R9VGM
https://apps.microsoft.com/store/detail/wpf-ui/9N9LKV8R9VGM?cid=windows-lp-hero
```powershell
$ winget install 'WPF UI'
......@@ -50,13 +50,6 @@ https://marketplace.visualstudio.com/items?itemName=lepo.wpf-ui
| **Wpf.Ui.FontMapper**<br />Console app for generating Fluent System Icons enums. | [![NET7](https://img.shields.io/badge/.NET-7.0-purple)](https://github.com/lepoco/wpfui/blob/main/src/Wpf.Ui.FontMapper/Wpf.Ui.FontMapper.csproj) |
| **Wpf.Ui.Extension**<br />Project for Visual Studio 2022 extension. | [![NETFramework48](https://img.shields.io/badge/.NET%20Framework-4.8-orange)](https://github.com/lepoco/wpfui/blob/main/src/Wpf.Ui.Extension/Wpf.Ui.Extension/Wpf.Ui.Extension.csproj) |
## 🏭 Branches
| Branch | Status |
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [**WPF UI - Main**](https://github.com/lepoco/wpfui/tree/main) | [![DotNet Main](https://github.com/lepoco/wpfui/actions/workflows/CI.yml/badge.svg)](https://github.com/lepoco/wpfui/actions/workflows/CI.yml) |
| [**WPF UI - Development**](https://github.com/lepoco/wpfui/tree/development) | [![DotNet Development](https://github.com/lepoco/wpfui/actions/workflows/DV.yml/badge.svg?branch=development)](https://github.com/lepoco/wpfui/actions/workflows/DV.yml) |
## 📷 Screenshots
![Demo App Sample](https://user-images.githubusercontent.com/13592821/166259110-0fb98120-fe34-4e6d-ab92-9f72ad7113c3.png)
......@@ -134,8 +127,8 @@ Now you can create fantastic apps, e.g. with one button:
Crafting apps for .NET without the creators of tools like ReSharper or XAML Styler would never be such a fantastic adventure.
- [🔗 JetBrains ReSharper](https://www.jetbrains.com/resharper/)
- [🔗 XAML Styler](https://github.com/Xavalon/XamlStyler)
- [🔗 JetBrains ReSharper](https://www.jetbrains.com/resharper/)
- [🔗 XAML Styler](https://github.com/Xavalon/XamlStyler)
## Microsoft Property
......
......@@ -38,5 +38,5 @@
"ThicknessSeparator": 2,
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
"FormatOnSave": true,
"CommentPadding": 2,
"CommentPadding": 2
}
\ No newline at end of file
{
"homepage": "https://github.com/lepoco/wpfui",
"name": "wpf-ui",
"version": "1.1.0",
"dependencies": {
"@fluentui/react-icons": "2.0.203"
}
}
\ No newline at end of file
......@@ -25,8 +25,10 @@ public class RtfDocumentProcessor : IDocumentProcessor
public ProcessingPriority GetProcessingPriority(FileAndType file)
{
if (file.Type == DocumentType.Article &&
".rtf".Equals(Path.GetExtension(file.File), StringComparison.OrdinalIgnoreCase))
if (
file.Type == DocumentType.Article
&& ".rtf".Equals(Path.GetExtension(file.File), StringComparison.OrdinalIgnoreCase)
)
{
return ProcessingPriority.Normal;
}
......@@ -65,7 +67,9 @@ private static HashSet<string> CollectLinksAndFixDocument(FileModel model)
var doc = XDocument.Parse(content);
var links =
from attr in doc.Descendants().Attributes()
where "href".Equals(attr.Name.LocalName, StringComparison.OrdinalIgnoreCase) || "src".Equals(attr.Name.LocalName, StringComparison.OrdinalIgnoreCase)
where
"href".Equals(attr.Name.LocalName, StringComparison.OrdinalIgnoreCase)
|| "src".Equals(attr.Name.LocalName, StringComparison.OrdinalIgnoreCase)
select attr;
var path = (RelativePath)model.File;
var linkToFiles = new HashSet<string>();
......@@ -83,7 +87,11 @@ private static HashSet<string> CollectLinksAndFixDocument(FileModel model)
#endregion
#region FixLink
private static void FixLink(XAttribute link, RelativePath filePath, HashSet<string> linkToFiles)
private static void FixLink(
XAttribute link,
RelativePath filePath,
HashSet<string> linkToFiles
)
{
string linkFile;
string anchor = null;
......@@ -111,8 +119,6 @@ private static void FixLink(XAttribute link, RelativePath filePath, HashSet<stri
}
#endregion
public void UpdateHref(FileModel model, IDocumentBuildContext context)
{
}
public void UpdateHref(FileModel model, IDocumentBuildContext context) { }
}
}
......@@ -22,7 +22,9 @@ public class RtfBuildStep : IDocumentBuildStep
public void Build(FileModel model, IHostService host)
{
string content = (string)((Dictionary<string, object>)model.Content)["conceptual"];
content = _taskFactory.StartNew(() => RtfToHtmlConverter.ConvertRtfToHtml(content)).Result;
content = _taskFactory
.StartNew(() => RtfToHtmlConverter.ConvertRtfToHtml(content))
.Result;
((Dictionary<string, object>)model.Content)["conceptual"] = content;
}
#endregion
......@@ -32,9 +34,7 @@ public void Build(FileModel model, IHostService host)
public string Name => nameof(RtfBuildStep);
public void Postbuild(ImmutableList<FileModel> models, IHostService host)
{
}
public void Postbuild(ImmutableList<FileModel> models, IHostService host) { }
public IEnumerable<FileModel> Prebuild(ImmutableList<FileModel> models, IHostService host)
{
......
......@@ -27,8 +27,10 @@ public class RtfDocumentProcessor : IDocumentProcessor
#region GetProcessingPriority
public ProcessingPriority GetProcessingPriority(FileAndType file)
{
if (file.Type == DocumentType.Article &&
".rtf".Equals(Path.GetExtension(file.File), StringComparison.OrdinalIgnoreCase))
if (
file.Type == DocumentType.Article
&& ".rtf".Equals(Path.GetExtension(file.File), StringComparison.OrdinalIgnoreCase)
)
{
return ProcessingPriority.Normal;
}
......@@ -45,12 +47,12 @@ public FileModel Load(FileAndType file, ImmutableDictionary<string, object> meta
["type"] = "Conceptual",
["path"] = file.File,
};
var localPathFromRoot = PathUtility.MakeRelativePath(EnvironmentContext.BaseDirectory, EnvironmentContext.FileAbstractLayer.GetPhysicalPath(file.File));
var localPathFromRoot = PathUtility.MakeRelativePath(
EnvironmentContext.BaseDirectory,
EnvironmentContext.FileAbstractLayer.GetPhysicalPath(file.File)
);
return new FileModel(file, content)
{
LocalPathFromRoot = localPathFromRoot,
};
return new FileModel(file, content) { LocalPathFromRoot = localPathFromRoot, };
}
#endregion
......@@ -66,9 +68,7 @@ public SaveResult Save(FileModel model)
#endregion
#region UpdateHref
public void UpdateHref(FileModel model, IDocumentBuildContext context)
{
}
public void UpdateHref(FileModel model, IDocumentBuildContext context) { }
#endregion
}
}
......@@ -4,7 +4,6 @@
// All Rights Reserved.
using System.IO;
using System.Reflection;
using System.Windows.Threading;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
......@@ -24,49 +23,53 @@ public partial class App
// https://docs.microsoft.com/dotnet/core/extensions/dependency-injection
// https://docs.microsoft.com/dotnet/core/extensions/configuration
// https://docs.microsoft.com/dotnet/core/extensions/logging
private static readonly IHost _host = Host
.CreateDefaultBuilder()
.ConfigureAppConfiguration(c => { c.SetBasePath(Path.GetDirectoryName(AppContext.BaseDirectory)); })
.ConfigureServices((context, services) =>
private static readonly IHost _host = Host.CreateDefaultBuilder()
.ConfigureAppConfiguration(c =>
{
// App Host
services.AddHostedService<ApplicationHostService>();
c.SetBasePath(Path.GetDirectoryName(AppContext.BaseDirectory));
})
.ConfigureServices(
(context, services) =>
{
// App Host
services.AddHostedService<ApplicationHostService>();
// Page resolver service
services.AddSingleton<IPageService, PageService>();
// Page resolver service
services.AddSingleton<IPageService, PageService>();
// Theme manipulation
services.AddSingleton<IThemeService, ThemeService>();
// Theme manipulation
services.AddSingleton<IThemeService, ThemeService>();
// TaskBar manipulation
services.AddSingleton<ITaskBarService, TaskBarService>();
// TaskBar manipulation
services.AddSingleton<ITaskBarService, TaskBarService>();
// Service containing navigation, same as INavigationWindow... but without window
services.AddSingleton<INavigationService, NavigationService>();
// Service containing navigation, same as INavigationWindow... but without window
services.AddSingleton<INavigationService, NavigationService>();
// Main window with navigation
services.AddScoped<INavigationWindow, Views.MainWindow>();
services.AddScoped<ViewModels.MainWindowViewModel>();
// Main window with navigation
services.AddSingleton<INavigationWindow, Views.MainWindow>();
services.AddSingleton<ViewModels.MainWindowViewModel>();
// Views and ViewModels
services.AddScoped<Views.Pages.DashboardPage>();
services.AddScoped<ViewModels.DashboardViewModel>();
services.AddScoped<Views.Pages.DataPage>();
services.AddScoped<ViewModels.DataViewModel>();
services.AddScoped<Views.Pages.SettingsPage>();
services.AddScoped<ViewModels.SettingsViewModel>();
// Views and ViewModels
services.AddSingleton<Views.Pages.DashboardPage>();
services.AddSingleton<ViewModels.DashboardViewModel>();
services.AddSingleton<Views.Pages.DataPage>();
services.AddSingleton<ViewModels.DataViewModel>();
services.AddSingleton<Views.Pages.SettingsPage>();
services.AddSingleton<ViewModels.SettingsViewModel>();
// Configuration
services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
}).Build();
// Configuration
services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
}
)
.Build();
/// <summary>
/// Gets registered service.
/// </summary>
/// <typeparam name="T">Type of the service to get.</typeparam>
/// <returns>Instance of the service or <see langword="null"/>.</returns>
public static T GetService<T>()
where T : class
public static T? GetService<T>() where T : class
{
return _host.Services.GetService(typeof(T)) as T;
}
......@@ -92,7 +95,10 @@ private async void OnExit(object sender, ExitEventArgs e)
/// <summary>
/// Occurs when an exception is thrown by an application but not handled.
/// </summary>
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
private void OnDispatcherUnhandledException(
object sender,
DispatcherUnhandledExceptionEventArgs e
)
{
// For more info see https://docs.microsoft.com/en-us/dotnet/api/system.windows.application.dispatcherunhandledexception?view=windowsdesktop-6.0
}
......
......@@ -7,9 +7,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
......@@ -48,7 +48,9 @@ private async Task HandleActivationAsync()
if (!Application.Current.Windows.OfType<MainWindow>().Any())
{
_navigationWindow = (_serviceProvider.GetService(typeof(INavigationWindow)) as INavigationWindow)!;
_navigationWindow = (
_serviceProvider.GetService(typeof(INavigationWindow)) as INavigationWindow
)!;
_navigationWindow!.ShowWindow();
_navigationWindow.Navigate(typeof(Views.Pages.DashboardPage));
......
......@@ -4,7 +4,7 @@
// All Rights Reserved.
using System.Windows.Media;
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Controls;
using Wpf.Ui.Demo.Mvvm.Models;
namespace Wpf.Ui.Demo.Mvvm.ViewModels;
......@@ -22,9 +22,7 @@ public void OnNavigatedTo()
InitializeViewModel();
}
public void OnNavigatedFrom()
{
}
public void OnNavigatedFrom() { }
private void InitializeViewModel()
{
......@@ -32,14 +30,19 @@ private void InitializeViewModel()
var colorCollection = new List<DataColor>();
for (int i = 0; i < 8192; i++)
colorCollection.Add(new DataColor
{
Color = new SolidColorBrush(Color.FromArgb(
(byte)200,
(byte)random.Next(0, 250),
(byte)random.Next(0, 250),
(byte)random.Next(0, 250)))
});
colorCollection.Add(
new DataColor
{
Color = new SolidColorBrush(
Color.FromArgb(
(byte)200,
(byte)random.Next(0, 250),
(byte)random.Next(0, 250),
(byte)random.Next(0, 250)
)
)
}
);
Colors = colorCollection;
......
......@@ -6,8 +6,6 @@
using System.Collections.ObjectModel;
using Wpf.Ui.Common;
using Wpf.Ui.Controls;
using Wpf.Ui.Controls.IconElements;
using Wpf.Ui.Controls.Navigation;
namespace Wpf.Ui.Demo.Mvvm.ViewModels;
......@@ -38,39 +36,35 @@ private void InitializeViewModel()
ApplicationTitle = "WPF UI - MVVM Demo";
NavigationItems = new ObservableCollection<object>
{
new NavigationViewItem()
{
new NavigationViewItem()
{
Content = "Home",
Icon = new SymbolIcon { Symbol = SymbolRegular.Home24 },
TargetPageType = typeof(Views.Pages.DashboardPage)
},
new NavigationViewItem()
{
Content = "Data",
Icon = new SymbolIcon { Symbol = SymbolRegular.DataHistogram24 },
TargetPageType = typeof(Views.Pages.DataPage)
}
};
Content = "Home",
Icon = new SymbolIcon { Symbol = SymbolRegular.Home24 },
TargetPageType = typeof(Views.Pages.DashboardPage)
},
new NavigationViewItem()
{
Content = "Data",
Icon = new SymbolIcon { Symbol = SymbolRegular.DataHistogram24 },
TargetPageType = typeof(Views.Pages.DataPage)
}
};
NavigationFooter = new ObservableCollection<object>
{
new NavigationViewItem()
{
new NavigationViewItem()
{
Content = "Settings",
Icon = new SymbolIcon { Symbol = SymbolRegular.Settings24 },
TargetPageType = typeof(Views.Pages.SettingsPage)
}
};
Content = "Settings",
Icon = new SymbolIcon { Symbol = SymbolRegular.Settings24 },
TargetPageType = typeof(Views.Pages.SettingsPage)
}
};
TrayMenuItems = new ObservableCollection<MenuItem>
{
new MenuItem
{
Header = "Home",
Tag = "tray_home"
}
};
{
new MenuItem { Header = "Home", Tag = "tray_home" }
};
_isInitialized = true;
}
......
......@@ -3,7 +3,7 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Demo.Mvvm.ViewModels;
......@@ -23,9 +23,7 @@ public void OnNavigatedTo()
InitializeViewModel();
}
public void OnNavigatedFrom()
{
}
public void OnNavigatedFrom() { }
private void InitializeViewModel()
{
......@@ -37,7 +35,8 @@ private void InitializeViewModel()
private string GetAssemblyVersion()
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? String.Empty;
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString()
?? String.Empty;
}
[RelayCommand]
......
......@@ -3,7 +3,7 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Demo.Mvvm.Views;
......@@ -12,12 +12,13 @@ namespace Wpf.Ui.Demo.Mvvm.Views;
/// </summary>
public partial class MainWindow : INavigationWindow
{
public ViewModels.MainWindowViewModel ViewModel
{
get;
}
public ViewModels.MainWindowViewModel ViewModel { get; }
public MainWindow(ViewModels.MainWindowViewModel viewModel, IPageService pageService, INavigationService navigationService)
public MainWindow(
ViewModels.MainWindowViewModel viewModel,
IPageService pageService,
INavigationService navigationService
)
{
ViewModel = viewModel;
DataContext = this;
......@@ -32,20 +33,16 @@ public MainWindow(ViewModels.MainWindowViewModel viewModel, IPageService pageSer
#region INavigationWindow methods
public INavigationView GetNavigation()
=> RootNavigation;
public INavigationView GetNavigation() => RootNavigation;
public bool Navigate(Type pageType)
=> RootNavigation.Navigate(pageType);
public bool Navigate(Type pageType) => RootNavigation.Navigate(pageType);
public void SetPageService(IPageService pageService)
=> RootNavigation.SetPageService(pageService);
public void SetPageService(IPageService pageService) =>
RootNavigation.SetPageService(pageService);
public void ShowWindow()
=> Show();
public void ShowWindow() => Show();
public void CloseWindow()
=> Close();
public void CloseWindow() => Close();
#endregion INavigationWindow methods
......
......@@ -3,7 +3,7 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
......@@ -12,10 +12,7 @@ namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
/// </summary>
public partial class DashboardPage : INavigableView<ViewModels.DashboardViewModel>
{
public ViewModels.DashboardViewModel ViewModel
{
get;
}
public ViewModels.DashboardViewModel ViewModel { get; }
public DashboardPage(ViewModels.DashboardViewModel viewModel)
{
......
<Page
<Page
x:Class="Wpf.Ui.Demo.Mvvm.Views.Pages.DataPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -15,6 +15,7 @@
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
ScrollViewer.CanContentScroll="False"
mc:Ignorable="d">
<Grid Margin="42">
......
......@@ -3,7 +3,7 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
......@@ -12,10 +12,7 @@ namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
/// </summary>
public partial class DataPage : INavigableView<ViewModels.DataViewModel>
{
public ViewModels.DataViewModel ViewModel
{
get;
}
public ViewModels.DataViewModel ViewModel { get; }
public DataPage(ViewModels.DataViewModel viewModel)
{
......
......@@ -3,7 +3,7 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
......@@ -12,10 +12,7 @@ namespace Wpf.Ui.Demo.Mvvm.Views.Pages;
/// </summary>
public partial class SettingsPage : INavigableView<ViewModels.SettingsViewModel>
{
public ViewModels.SettingsViewModel ViewModel
{
get;
}
public ViewModels.SettingsViewModel ViewModel { get; }
public SettingsPage(ViewModels.SettingsViewModel viewModel)
{
......
......@@ -8,6 +8,4 @@ namespace Wpf.Ui.Demo.Simple;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
{
}
public partial class App { }
......@@ -2,9 +2,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
<Page
<Page
x:Class="Wpf.Ui.Demo.Simple.Views.Pages.DataPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
......@@ -13,6 +13,7 @@
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
ScrollViewer.CanContentScroll="False"
mc:Ignorable="d">
<Grid Margin="42">
......
......@@ -30,13 +30,18 @@ private void InitializeData()
var random = new Random();
for (int i = 0; i < 8192; i++)
ColorsCollection.Add(new DataColor
{
Color = new SolidColorBrush(Color.FromArgb(
(byte)200,
(byte)random.Next(0, 250),
(byte)random.Next(0, 250),
(byte)random.Next(0, 250)))
});
ColorsCollection.Add(
new DataColor
{
Color = new SolidColorBrush(
Color.FromArgb(
(byte)200,
(byte)random.Next(0, 250),
(byte)random.Next(0, 250),
(byte)random.Next(0, 250)
)
)
}
);
}
}
......@@ -38,6 +38,7 @@ private void OnDarkThemeRadioButtonChecked(object sender, RoutedEventArgs e)
private string GetAssemblyVersion()
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? String.Empty;
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString()
?? String.Empty;
}
}
<Application
x:Class="$safeprojectname$.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
DispatcherUnhandledException="OnDispatcherUnhandledException"
Exit="OnExit"
Startup="OnStartup">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Threading;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;
using $safeprojectname$.Models;
using $safeprojectname$.Services;
namespace $safeprojectname$
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
{
// The.NET Generic Host provides dependency injection, configuration, logging, and other services.
// https://docs.microsoft.com/dotnet/core/extensions/generic-host
// https://docs.microsoft.com/dotnet/core/extensions/dependency-injection
// https://docs.microsoft.com/dotnet/core/extensions/configuration
// https://docs.microsoft.com/dotnet/core/extensions/logging
private static readonly IHost _host = Host
.CreateDefaultBuilder()
.ConfigureAppConfiguration(c => { c.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)); })
.ConfigureServices((context, services) =>
{
// App Host
services.AddHostedService<ApplicationHostService>();
// Page resolver service
services.AddSingleton<IPageService, PageService>();
// Theme manipulation
services.AddSingleton<IThemeService, ThemeService>();
// TaskBar manipulation
services.AddSingleton<ITaskBarService, TaskBarService>();
// Service containing navigation, same as INavigationWindow... but without window
services.AddSingleton<INavigationService, NavigationService>();
// Main window with navigation
services.AddScoped<INavigationWindow, Views.Windows.MainWindow>();
services.AddScoped<ViewModels.MainWindowViewModel>();
// Views and ViewModels
services.AddScoped<Views.Pages.DashboardPage>();
services.AddScoped<ViewModels.DashboardViewModel>();
services.AddScoped<Views.Pages.DataPage>();
services.AddScoped<ViewModels.DataViewModel>();
services.AddScoped<Views.Pages.SettingsPage>();
services.AddScoped<ViewModels.SettingsViewModel>();
// Configuration
services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
}).Build();
/// <summary>
/// Gets registered service.
/// </summary>
/// <typeparam name="T">Type of the service to get.</typeparam>
/// <returns>Instance of the service or <see langword="null"/>.</returns>
public static T GetService<T>()
where T : class
{
return _host.Services.GetService(typeof(T)) as T;
}
/// <summary>
/// Occurs when the application is loading.
/// </summary>
private async void OnStartup(object sender, StartupEventArgs e)
{
await _host.StartAsync();
}
/// <summary>
/// Occurs when the application is closing.
/// </summary>
private async void OnExit(object sender, ExitEventArgs e)
{
await _host.StopAsync();
_host.Dispose();
}
/// <summary>
/// Occurs when an exception is thrown by an application but not handled.
/// </summary>
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
// For more info see https://docs.microsoft.com/en-us/dotnet/api/system.windows.application.dispatcherunhandledexception?view=windowsdesktop-6.0
}
}
}
\ No newline at end of file
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MinimumVisualStudioVersion>17.0</MinimumVisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>15.0</OldToolsVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>11.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>11.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{14D7431C-6CFF-4191-BB88-2B8D5F323A30}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wpf.Ui.Mvvm.CompactNavigation</RootNamespace>
<AssemblyName>Wpf.Ui.Mvvm.CompactNavigation</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<GeneratePkgDefFile>false</GeneratePkgDefFile>
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<CreateVsixContainer>false</CreateVsixContainer>
<DeployExtension>false</DeployExtension>
<DeployVSTemplates>false</DeployVSTemplates>
<CopyVsixManifestToOutput>false</CopyVsixManifestToOutput>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Content Include="Wpf.Ui.Extension.Template.csproj" />
<Content Include="__PreviewImage.png" />
<Content Include="__TemplateIcon.png" />
<VSTemplate Include="Wpf.Ui.Extension.Template.vstemplate">
<OutputSubPath>Wpf.Ui.Extension.Template</OutputSubPath>
</VSTemplate>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>wpfui-icon.ico</ApplicationIcon>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<Content Include="wpfui-icon.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WPF-UI" Version="3.0.0-preview.3" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1 " />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.0 "/>
</ItemGroup>
<ItemGroup>
<None Remove="Assets\wpfui-icon-256.png" />
<None Remove="Assets\wpfui-icon-1024.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\wpfui-icon-256.png" />
<Resource Include="Assets\wpfui-icon-1024.png" />
</ItemGroup>
</Project>
<VSTemplate Version="3.0.0"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>WPF UI - Compact Navigation (MVVM | DI)</Name>
<Description>Template for creating WPF UI project with MVVM pattern, Dependency Injection, Compact navigation and Mica background.</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType></ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>UiDesktopApp</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<CreateInPlace>true</CreateInPlace>
<Icon>__TemplateIcon.png</Icon>
<LanguageTag>csharp</LanguageTag>
<LanguageTag>XAML</LanguageTag>
<PlatformTag>Windows</PlatformTag>
<ProjectTypeTag>Desktop</ProjectTypeTag>
<ProjectTypeTag>WPF UI</ProjectTypeTag>
<ProjectTypeTag>MVVM</ProjectTypeTag>
<PreviewImage>__PreviewImage.png</PreviewImage>
</TemplateData>
<TemplateContent>
<Project TargetFileName="Wpf.Ui.Mvvm.CompactNavigation.csproj" File="Wpf.Ui.Mvvm.CompactNavigation.csproj" ReplaceParameters="true">
<Folder Name="Assets" TargetFolderName="Assets">
<ProjectItem ReplaceParameters="false" TargetFileName="wpfui-icon-256.png">wpfui-icon-256.png</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="wpfui-icon-1024.png">wpfui-icon-1024.png</ProjectItem>
</Folder>
<Folder Name="Helpers" TargetFolderName="Helpers">
<ProjectItem ReplaceParameters="true" TargetFileName="EnumToBooleanConverter.cs">EnumToBooleanConverter.cs</ProjectItem>
</Folder>
<Folder Name="Models" TargetFolderName="Models">
<ProjectItem ReplaceParameters="true" TargetFileName="AppConfig.cs">AppConfig.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="DataColor.cs">DataColor.cs</ProjectItem>
</Folder>
<Folder Name="Services" TargetFolderName="Services">
<ProjectItem ReplaceParameters="true" TargetFileName="ApplicationHostService.cs">ApplicationHostService.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="PageService.cs">PageService.cs</ProjectItem>
</Folder>
<Folder Name="ViewModels" TargetFolderName="ViewModels">
<ProjectItem ReplaceParameters="true" TargetFileName="MainWindowViewModel.cs">MainWindowViewModel.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="DashboardViewModel.cs">DashboardViewModel.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="DataViewModel.cs">DataViewModel.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="SettingsViewModel.cs">SettingsViewModel.cs</ProjectItem>
</Folder>
<Folder Name="Views" TargetFolderName="Views">
<Folder Name="Pages" TargetFolderName="Pages">
<ProjectItem ReplaceParameters="true" TargetFileName="DashboardPage.xaml">DashboardPage.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="DashboardPage.xaml.cs">DashboardPage.xaml.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="DataPage.xaml">DataPage.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="DataPage.xaml.cs">DataPage.xaml.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="SettingsPage.xaml">SettingsPage.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="SettingsPage.xaml.cs">SettingsPage.xaml.cs</ProjectItem>
</Folder>
<Folder Name="Windows" TargetFolderName="Windows">
<ProjectItem ReplaceParameters="true" TargetFileName="MainWindow.xaml">MainWindow.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="MainWindow.xaml.cs">MainWindow.xaml.cs</ProjectItem>
</Folder>
</Folder>
<ProjectItem ReplaceParameters="true" TargetFileName="app.manifest">app.manifest</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="wpfui-icon.ico">wpfui-icon.ico</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="App.xaml">App.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="App.xaml.cs">App.xaml.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
</Project>
</TemplateContent>
</VSTemplate>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="$safeprojectname$.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="https://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>
......@@ -2,9 +2,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
......@@ -2,9 +2,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
......@@ -2,9 +2,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WPF UI")]
......@@ -13,19 +13,19 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
......
......@@ -2,9 +2,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
......@@ -2,9 +2,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
......@@ -2,9 +2,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WPF UI")]
......@@ -13,19 +13,19 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
......
namespace Wpf.Ui.FontMapper;
record GitTag(
string Ref,
string Node_Id,
string Url);
record GitTag(string Ref, string Node_Id, string Url);
......@@ -15,16 +15,16 @@
);
var regularIcons = new FontSource(
"SymbolRegular",
"Represents a list of regular Fluent System Icons <c>v.{{FLUENT_SYSTEM_ICONS_VERSION}}</c>.\n<para>May be converted to <see langword=\"char\"/> using <c>GetGlyph()</c> or to <see langword=\"string\"/> using <c>GetString()</c></para>",
@"https://raw.githubusercontent.com/microsoft/fluentui-system-icons/main/fonts/FluentSystemIcons-Regular.json",
"generated\\SymbolRegular.cs"
"SymbolRegular",
"Represents a list of regular Fluent System Icons <c>v.{{FLUENT_SYSTEM_ICONS_VERSION}}</c>.\n<para>May be converted to <see langword=\"char\"/> using <c>GetGlyph()</c> or to <see langword=\"string\"/> using <c>GetString()</c></para>",
@"https://raw.githubusercontent.com/microsoft/fluentui-system-icons/main/fonts/FluentSystemIcons-Regular.json",
"generated\\SymbolRegular.cs"
);
var filledIcons = new FontSource(
"SymbolFilled",
"Represents a list of filled Fluent System Icons <c>v.{{FLUENT_SYSTEM_ICONS_VERSION}}</c>.\n<para>May be converted to <see langword=\"char\"/> using <c>GetGlyph()</c> or to <see langword=\"string\"/> using <c>GetString()</c></para>",
@"https://raw.githubusercontent.com/microsoft/fluentui-system-icons/main/fonts/FluentSystemIcons-Filled.json",
"generated\\SymbolFilled.cs"
"SymbolFilled",
"Represents a list of filled Fluent System Icons <c>v.{{FLUENT_SYSTEM_ICONS_VERSION}}</c>.\n<para>May be converted to <see langword=\"char\"/> using <c>GetGlyph()</c> or to <see langword=\"string\"/> using <c>GetString()</c></para>",
@"https://raw.githubusercontent.com/microsoft/fluentui-system-icons/main/fonts/FluentSystemIcons-Filled.json",
"generated\\SymbolFilled.cs"
);
var fetchVersionAsync = async () =>
......@@ -32,15 +32,22 @@
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; AcmeInc/1.0)");
return (await httpClient.GetFromJsonAsync<IEnumerable<GitTag>>(@"https://api.github.com/repos/microsoft/fluentui-system-icons/git/refs/tags"))?.Last()?.Ref.Replace("refs/tags/", String.Empty).Trim()
?? throw new Exception("Unable to parse the verison string");
return (
await httpClient.GetFromJsonAsync<IEnumerable<GitTag>>(
@"https://api.github.com/repos/microsoft/fluentui-system-icons/git/refs/tags"
)
)
?.Last()
?.Ref.Replace("refs/tags/", String.Empty)
.Trim() ?? throw new Exception("Unable to parse the verison string");
};
var formatIconName = (string rawIconName) =>
{
rawIconName = rawIconName.Replace("ic_fluent_", String.Empty)
.Replace("_regular", String.Empty)
.Replace("_filled", String.Empty);
rawIconName = rawIconName
.Replace("ic_fluent_", String.Empty)
.Replace("_regular", String.Empty)
.Replace("_filled", String.Empty);
var iconName = String.Empty;
......@@ -60,13 +67,13 @@
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; AcmeInc/1.0)");
var sourceJsonContent = await httpClient.GetFromJsonAsync<Dictionary<string, long>>(source.SourcePath) ?? throw new Exception("Unable to obtain JSON data");
var sourceJsonContent =
await httpClient.GetFromJsonAsync<Dictionary<string, long>>(source.SourcePath)
?? throw new Exception("Unable to obtain JSON data");
sourceJsonContent = sourceJsonContent
.OrderBy(x => x.Value)
.ToDictionary(
k => formatIconName(k.Key),
v => v.Value);
.ToDictionary(k => formatIconName(k.Key), v => v.Value);
source.SetContents(sourceJsonContent);
source.UpdateVersion(version);
......@@ -103,9 +110,7 @@
enumMapStringBuilder.AppendLine(
"// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT."
);
enumMapStringBuilder.AppendLine(
"// Copyright (C) Leszek Pomianowski and WPF UI Contributors."
);
enumMapStringBuilder.AppendLine("// Copyright (C) Leszek Pomianowski and WPF UI Contributors.");
enumMapStringBuilder.AppendLine("// All Rights Reserved.");
enumMapStringBuilder.AppendLine("");
enumMapStringBuilder.AppendLine("namespace Wpf.Ui.Common;");
......
......@@ -2,6 +2,7 @@
x:Class="Wpf.Ui.Gallery.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:helpers="clr-namespace:Wpf.Ui.Gallery.Helpers"
xmlns:local="clr-namespace:Wpf.Ui.Gallery"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
DispatcherUnhandledException="OnDispatcherUnhandledException"
......@@ -12,12 +13,13 @@
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
<ResourceDictionary Source="Controls/ControlDocumentationSummary.xaml" />
<ResourceDictionary Source="Controls/GalleryControlPresenter.xaml" />
<ResourceDictionary Source="Controls/GalleryNavigationPresenter.xaml" />
<ResourceDictionary Source="Controls/ControlExample.xaml" />
<ResourceDictionary Source="Controls/TypographyControl.xaml" />
<ResourceDictionary Source="Controls/PageControlDocumentation.xaml" />
</ResourceDictionary.MergedDictionaries>
<helpers:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>
......@@ -11,8 +11,8 @@
using Wpf.Ui.Gallery.ViewModels.Pages.BasicInput;
using Wpf.Ui.Gallery.ViewModels.Pages.Collections;
using Wpf.Ui.Gallery.ViewModels.Pages.DateAndTime;
using Wpf.Ui.Gallery.ViewModels.Pages.DesignGuidance;
using Wpf.Ui.Gallery.ViewModels.Pages.DialogsAndFlyouts;
using Wpf.Ui.Gallery.ViewModels.Pages.Icons;
using Wpf.Ui.Gallery.ViewModels.Pages.Layout;
using Wpf.Ui.Gallery.ViewModels.Pages.Media;
using Wpf.Ui.Gallery.ViewModels.Pages.Navigation;
......@@ -26,7 +26,6 @@
using Wpf.Ui.Gallery.Views.Pages.DateAndTime;
using Wpf.Ui.Gallery.Views.Pages.DesignGuidance;
using Wpf.Ui.Gallery.Views.Pages.DialogsAndFlyouts;
using Wpf.Ui.Gallery.Views.Pages.Icons;
using Wpf.Ui.Gallery.Views.Pages.Layout;
using Wpf.Ui.Gallery.Views.Pages.Media;
using Wpf.Ui.Gallery.Views.Pages.Navigation;
......@@ -49,187 +48,188 @@ public partial class App : Application
// https://docs.microsoft.com/dotnet/core/extensions/dependency-injection
// https://docs.microsoft.com/dotnet/core/extensions/configuration
// https://docs.microsoft.com/dotnet/core/extensions/logging
private static readonly IHost _host = Host
.CreateDefaultBuilder()
.ConfigureAppConfiguration(c => { c.SetBasePath(AppContext.BaseDirectory); })
.ConfigureServices((context, services) =>
private static readonly IHost _host = Host.CreateDefaultBuilder()
.ConfigureAppConfiguration(c =>
{
// App Host
services.AddHostedService<ApplicationHostService>();
c.SetBasePath(AppContext.BaseDirectory);
})
.ConfigureServices(
(context, services) =>
{
// App Host
services.AddHostedService<ApplicationHostService>();
// Main window container with navigation
services.AddSingleton<IWindow, MainWindow>();
services.AddSingleton<MainWindowViewModel>();
services.AddSingleton<INavigationService, NavigationService>();
services.AddSingleton<ISnackbarService, SnackbarService>();
services.AddSingleton<IContentDialogService, ContentDialogService>();
services.AddSingleton<WindowsProviderService>();
// Main window container with navigation
services.AddSingleton<IWindow, MainWindow>();
services.AddSingleton<MainWindowViewModel>();
services.AddSingleton<INavigationService, NavigationService>();
services.AddSingleton<ISnackbarService, SnackbarService>();
services.AddSingleton<IContentDialogService, ContentDialogService>();
services.AddSingleton<WindowsProviderService>();
// Top-level pages
services.AddTransient<DashboardPage>();
services.AddTransient<DashboardViewModel>();
services.AddTransient<AllControlsPage>();
services.AddTransient<AllControlsViewModel>();
services.AddTransient<SettingsPage>();
services.AddTransient<SettingsViewModel>();
// Top-level pages
services.AddSingleton<DashboardPage>();
services.AddSingleton<DashboardViewModel>();
services.AddSingleton<AllControlsPage>();
services.AddSingleton<AllControlsViewModel>();
services.AddSingleton<SettingsPage>();
services.AddSingleton<SettingsViewModel>();
//Design guidance
services.AddTransient<TypographyPage>();
//Design guidance
services.AddTransient<TypographyPage>();
services.AddTransient<TypographyViewModel>();
services.AddTransient<IconsPage>();
services.AddTransient<IconsViewModel>();
services.AddTransient<ColorsPage>();
services.AddTransient<ColorsViewModel>();
// Basic Input
services.AddTransient<BasicInputPage>();
services.AddTransient<BasicInputViewModel>();
services.AddTransient<AnchorPage>();
services.AddTransient<AnchorViewModel>();
services.AddTransient<ButtonPage>();
services.AddTransient<ButtonViewModel>();
services.AddTransient<HyperlinkPage>();
services.AddTransient<HyperlinkViewModel>();
services.AddTransient<ToggleButtonPage>();
services.AddTransient<ToggleButtonViewModel>();
services.AddTransient<ToggleSwitchPage>();
services.AddTransient<ToggleSwitchViewModel>();
services.AddTransient<CheckBoxPage>();
services.AddTransient<CheckBoxViewModel>();
services.AddTransient<ComboBoxPage>();
services.AddTransient<ComboBoxViewModel>();
services.AddTransient<RadioButtonPage>();
services.AddTransient<RadioButtonViewModel>();
services.AddTransient<RatingPage>();
services.AddTransient<RatingViewModel>();
services.AddTransient<ThumbRatePage>();
services.AddTransient<ThumbRateViewModel>();
services.AddTransient<SliderPage>();
services.AddTransient<SliderViewModel>();
// Basic Input
services.AddTransient<BasicInputPage>();
services.AddTransient<BasicInputViewModel>();
services.AddTransient<AnchorPage>();
services.AddTransient<AnchorViewModel>();
services.AddTransient<ButtonPage>();
services.AddTransient<ButtonViewModel>();
services.AddTransient<HyperlinkPage>();
services.AddTransient<HyperlinkViewModel>();
services.AddTransient<ToggleButtonPage>();
services.AddTransient<ToggleButtonViewModel>();
services.AddTransient<ToggleSwitchPage>();
services.AddTransient<ToggleSwitchViewModel>();
services.AddTransient<CheckBoxPage>();
services.AddTransient<CheckBoxViewModel>();
services.AddTransient<ComboBoxPage>();
services.AddTransient<ComboBoxViewModel>();
services.AddTransient<RadioButtonPage>();
services.AddTransient<RadioButtonViewModel>();
services.AddTransient<RatingPage>();
services.AddTransient<RatingViewModel>();
services.AddTransient<ThumbRatePage>();
services.AddTransient<ThumbRateViewModel>();
services.AddTransient<SliderPage>();
services.AddTransient<SliderViewModel>();
// Collections
services.AddTransient<CollectionsPage>();
services.AddTransient<CollectionsViewModel>();
services.AddTransient<DataGridPage>();
services.AddTransient<DataGridViewModel>();
services.AddTransient<ListBoxPage>();
services.AddTransient<ListBoxViewModel>();
services.AddTransient<ListViewPage>();
services.AddTransient<ListViewViewModel>();
services.AddTransient<TreeViewPage>();
services.AddTransient<TreeViewViewModel>();
services.AddTransient<TreeListPage>();
services.AddTransient<TreeListViewModel>();
// Collections
services.AddTransient<CollectionsPage>();
services.AddTransient<CollectionsViewModel>();
services.AddTransient<DataGridPage>();
services.AddTransient<DataGridViewModel>();
services.AddTransient<ListBoxPage>();
services.AddTransient<ListBoxViewModel>();
services.AddTransient<ListViewPage>();
services.AddTransient<ListViewViewModel>();
services.AddTransient<TreeViewPage>();
services.AddTransient<TreeViewViewModel>();
services.AddTransient<TreeListPage>();
services.AddTransient<TreeListViewModel>();
// Date and Time
services.AddTransient<DateAndTimePage>();
services.AddTransient<DateAndTimeViewModel>();
services.AddTransient<CalendarPage>();
services.AddTransient<CalendarViewModel>();
services.AddTransient<DatePickerPage>();
services.AddTransient<DatePickerViewModel>();
// Date and Time
services.AddTransient<DateAndTimePage>();
services.AddTransient<DateAndTimeViewModel>();
services.AddTransient<CalendarPage>();
services.AddTransient<CalendarViewModel>();
services.AddTransient<DatePickerPage>();
services.AddTransient<DatePickerViewModel>();
// Dialogs and Flyouts
services.AddTransient<DialogsAndFlyoutsPage>();
services.AddTransient<DialogsAndFlyoutsViewModel>();
services.AddTransient<SnackbarPage>();
services.AddTransient<SnackbarViewModel>();
services.AddTransient<ContentDialogPage>();
services.AddTransient<ContentDialogViewModel>();
services.AddTransient<FlyoutPage>();
services.AddTransient<FlyoutViewModel>();
services.AddTransient<MessageBoxPage>();
services.AddTransient<MessageBoxViewModel>();
// Dialogs and Flyouts
services.AddTransient<DialogsAndFlyoutsPage>();
services.AddTransient<DialogsAndFlyoutsViewModel>();
services.AddTransient<SnackbarPage>();
services.AddTransient<SnackbarViewModel>();
services.AddTransient<ContentDialogPage>();
services.AddTransient<ContentDialogViewModel>();
services.AddTransient<FlyoutPage>();
services.AddTransient<FlyoutViewModel>();
services.AddTransient<MessageBoxPage>();
services.AddTransient<MessageBoxViewModel>();
// Layout
services.AddTransient<LayoutPage>();
services.AddTransient<LayoutViewModel>();
services.AddTransient<ExpanderPage>();
services.AddTransient<ExpanderViewModel>();
// Layout
services.AddTransient<LayoutPage>();
services.AddTransient<LayoutViewModel>();
services.AddTransient<ExpanderPage>();
services.AddTransient<ExpanderViewModel>();
// Web View
services.AddTransient<MediaPage>();
services.AddTransient<MediaViewModel>();
services.AddTransient<ImagePage>();
services.AddTransient<ImageViewModel>();
services.AddTransient<CanvasPage>();
services.AddTransient<CanvasViewModel>();
services.AddTransient<WebViewPage>();
services.AddTransient<WebViewViewModel>();
services.AddTransient<WebBrowserPage>();
services.AddTransient<WebBrowserViewModel>();
// Web View
services.AddTransient<MediaPage>();
services.AddTransient<MediaViewModel>();
services.AddTransient<ImagePage>();
services.AddTransient<ImageViewModel>();
services.AddTransient<CanvasPage>();
services.AddTransient<CanvasViewModel>();
services.AddTransient<WebViewPage>();
services.AddTransient<WebViewViewModel>();
services.AddTransient<WebBrowserPage>();
services.AddTransient<WebBrowserViewModel>();
// Navigation
services.AddTransient<BreadcrumbBarPage>();
services.AddTransient<BreadcrumbBarViewModel>();
services.AddTransient<MenuPage>();
services.AddTransient<MenuViewModel>();
services.AddTransient<NavigationPage>();
services.AddTransient<NavigationViewModel>();
services.AddTransient<NavigationViewPage>();
services.AddTransient<MultilevelNavigationPage>();
services.AddTransient<NavigationViewViewModel>();
services.AddTransient<TabControlPage>();
services.AddTransient<TabControlViewModel>();
services.AddTransient<TabViewPage>();
services.AddTransient<TabViewViewModel>();
// Navigation
services.AddTransient<BreadcrumbBarPage>();
services.AddTransient<BreadcrumbBarViewModel>();
services.AddTransient<MenuPage>();
services.AddTransient<MenuViewModel>();
services.AddTransient<NavigationPage>();
services.AddTransient<NavigationViewModel>();
services.AddTransient<NavigationViewPage>();
services.AddTransient<MultilevelNavigationPage>();
services.AddTransient<NavigationViewViewModel>();
services.AddTransient<TabControlPage>();
services.AddTransient<TabControlViewModel>();
services.AddTransient<TabViewPage>();
services.AddTransient<TabViewViewModel>();
// Multilevel navigation sample Pages
services.AddTransient<MultilevelNavigationSample>();
services.AddTransient<MultilevelNavigationSamplePage1>();
services.AddTransient<MultilevelNavigationSamplePage2>();
services.AddTransient<MultilevelNavigationSamplePage3>();
// Multilevel navigation sample Pages
services.AddTransient<MultilevelNavigationSample>();
services.AddTransient<MultilevelNavigationSamplePage1>();
services.AddTransient<MultilevelNavigationSamplePage2>();
services.AddTransient<MultilevelNavigationSamplePage3>();
// Status and Info
services.AddTransient<StatusAndInfoPage>();
services.AddTransient<StatusAndInfoViewModel>();
services.AddTransient<InfoBarPage>();
services.AddTransient<InfoBarViewModel>();
services.AddTransient<ProgressBarPage>();
services.AddTransient<ProgressBarViewModel>();
services.AddTransient<ProgressRingPage>();
services.AddTransient<ProgressRingViewModel>();
services.AddTransient<ToolTipPage>();
services.AddTransient<ToolTipViewModel>();
// Status and Info
services.AddTransient<StatusAndInfoPage>();
services.AddTransient<StatusAndInfoViewModel>();
services.AddTransient<InfoBarPage>();
services.AddTransient<InfoBarViewModel>();
services.AddTransient<ProgressBarPage>();
services.AddTransient<ProgressBarViewModel>();
services.AddTransient<ProgressRingPage>();
services.AddTransient<ProgressRingViewModel>();
services.AddTransient<ToolTipPage>();
services.AddTransient<ToolTipViewModel>();
// Text
services.AddTransient<TextPage>();
services.AddTransient<TextViewModel>();
services.AddTransient<AutoSuggestBoxPage>();
services.AddTransient<AutoSuggestBoxViewModel>();
services.AddTransient<NumberBoxPage>();
services.AddTransient<NumberBoxViewModel>();
services.AddTransient<PasswordBoxPage>();
services.AddTransient<PasswordBoxViewModel>();
services.AddTransient<RichTextBoxPage>();
services.AddTransient<RichTextBoxViewModel>();
services.AddTransient<LabelPage>();
services.AddTransient<LabelViewModel>();
services.AddTransient<TextBlockPage>();
services.AddTransient<TextBlockViewModel>();
services.AddTransient<TextBoxPage>();
services.AddTransient<TextBoxViewModel>();
// Text
services.AddTransient<TextPage>();
services.AddTransient<TextViewModel>();
services.AddTransient<AutoSuggestBoxPage>();
services.AddTransient<AutoSuggestBoxViewModel>();
services.AddTransient<NumberBoxPage>();
services.AddTransient<NumberBoxViewModel>();
services.AddTransient<PasswordBoxPage>();
services.AddTransient<PasswordBoxViewModel>();
services.AddTransient<RichTextBoxPage>();
services.AddTransient<RichTextBoxViewModel>();
services.AddTransient<LabelPage>();
services.AddTransient<LabelViewModel>();
services.AddTransient<TextBlockPage>();
services.AddTransient<TextBlockViewModel>();
services.AddTransient<TextBoxPage>();
services.AddTransient<TextBoxViewModel>();
// Icons
services.AddTransient<IconsPage>();
services.AddTransient<IconsViewModel>();
services.AddTransient<SymbolIconPage>();
services.AddTransient<SymbolIconViewModel>();
services.AddTransient<FontIconPage>();
services.AddTransient<FontIconViewModel>();
// Windows
services.AddTransient<WindowsPage>();
services.AddTransient<WindowsViewModel>();
// Windows
services.AddTransient<WindowsPage>();
services.AddTransient<WindowsViewModel>();
services.AddTransient<EditorWindow>();
services.AddTransient<EditorWindowViewModel>();
services.AddTransient<MonacoWindow>();
services.AddTransient<MonacoWindowViewModel>();
}).Build();
services.AddTransient<EditorWindow>();
services.AddTransient<EditorWindowViewModel>();
services.AddTransient<MonacoWindow>();
services.AddTransient<MonacoWindowViewModel>();
}
)
.Build();
/// <summary>
/// Gets registered service.
/// </summary>
/// <typeparam name="T">Type of the service to get.</typeparam>
/// <returns>Instance of the service or <see langword="null"/>.</returns>
public static T? GetService<T>()
where T : class
public static T? GetService<T>() where T : class
{
return _host.Services.GetService(typeof(T)) as T ?? null;
}
......@@ -237,17 +237,17 @@ public partial class App : Application
/// <summary>
/// Occurs when the application is loading.
/// </summary>
private async void OnStartup(object sender, StartupEventArgs e)
private void OnStartup(object sender, StartupEventArgs e)
{
await _host.StartAsync();
_host.Start();
}
/// <summary>
/// Occurs when the application is closing.
/// </summary>
private async void OnExit(object sender, ExitEventArgs e)
private void OnExit(object sender, ExitEventArgs e)
{
await _host.StopAsync();
_host.StopAsync().Wait();
_host.Dispose();
}
......@@ -255,7 +255,10 @@ private async void OnExit(object sender, ExitEventArgs e)
/// <summary>
/// Occurs when an exception is thrown by an application but not handled.
/// </summary>
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
private void OnDispatcherUnhandledException(
object sender,
DispatcherUnhandledExceptionEventArgs e
)
{
// For more info see https://docs.microsoft.com/en-us/dotnet/api/system.windows.application.dispatcherunhandledexception?view=windowsdesktop-6.0
}
......
......@@ -7,9 +7,9 @@
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
......@@ -26,10 +26,12 @@ public MonacoController(WebView2 webView)
public async Task CreateAsync()
{
await _webView.ExecuteScriptAsync($$"""
await _webView.ExecuteScriptAsync(
$$"""
const {{EditorObject}} = monaco.editor.create(document.querySelector('{{EditorContainerSelector}}'));
window.onresize = () => {{{EditorObject}}.layout();}
""");
"""
);
}
public async Task SetThemeAsync(ThemeType appTheme)
......@@ -39,21 +41,28 @@ public async Task SetThemeAsync(ThemeType appTheme)
// TODO: Parse theme from object
await _webView.ExecuteScriptAsync($$$"""
await _webView.ExecuteScriptAsync(
$$$"""
monaco.editor.defineTheme('{{{uiThemeName}}}', {
base: '{{{baseMonacoTheme}}}',
inherit: true,
rules: [{ background: 'FFFFFF00' }],
colors: {'editor.background': '#FFFFFF00','minimap.background': '#FFFFFF00',}});
monaco.editor.setTheme('{{{uiThemeName}}}');
""");
"""
);
}
public async Task SetLanguageAsync(MonacoLanguage monacoLanguage)
{
var languageId = monacoLanguage == MonacoLanguage.ObjectiveC ? "objective-c" : monacoLanguage.ToString().ToLower();
await _webView.ExecuteScriptAsync("monaco.editor.setModelLanguage(" + EditorObject + $".getModel(), \"{languageId}\");");
var languageId =
monacoLanguage == MonacoLanguage.ObjectiveC
? "objective-c"
: monacoLanguage.ToString().ToLower();
await _webView.ExecuteScriptAsync(
"monaco.editor.setModelLanguage(" + EditorObject + $".getModel(), \"{languageId}\");"
);
}
public async Task SetContentAsync(string contents)
......@@ -68,6 +77,8 @@ public void DispatchScript(string script)
if (_webView == null)
return;
Application.Current.Dispatcher.InvokeAsync(async () => await _webView!.ExecuteScriptAsync(script));
Application.Current.Dispatcher.InvokeAsync(
async () => await _webView!.ExecuteScriptAsync(script)
);
}
}
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System;
using System.Windows;
namespace Wpf.Ui.Gallery.Controls;
public class ControlDocumentationSummary : System.Windows.Controls.Control
{
/// <summary>
/// Property for <see cref="XamlUrl"/>.
/// </summary>
public static readonly DependencyProperty XamlUrlProperty =
DependencyProperty.Register(nameof(XamlUrl),
typeof(string), typeof(ControlDocumentationSummary), new PropertyMetadata(String.Empty));
/// <summary>
/// Property for <see cref="CsharpUrl"/>.
/// </summary>
public static readonly DependencyProperty CsharpUrlProperty =
DependencyProperty.Register(nameof(CsharpUrl),
typeof(string), typeof(ControlDocumentationSummary), new PropertyMetadata(String.Empty));
public string XamlUrl
{
get => (string)GetValue(XamlUrlProperty);
set => SetValue(XamlUrlProperty, value);
}
public string CsharpUrl
{
get => (string)GetValue(CsharpUrlProperty);
set => SetValue(CsharpUrlProperty, value);
}
}
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<Style TargetType="{x:Type controls:ControlDocumentationSummary}">
<Setter Property="Focusable" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:ControlDocumentationSummary}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="280" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" Margin="0,-32,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Margin="0,0,0,12"
FontSize="18"
FontWeight="DemiBold"
Text="View on GitHub" />
<ui:Hyperlink
Grid.Row="1"
Content="XAML source code"
NavigateUri="{TemplateBinding XamlUrl}"
ToolTip="{TemplateBinding XamlUrl}" />
<ui:Hyperlink
Grid.Row="2"
Content="C# source code"
NavigateUri="{TemplateBinding CsharpUrl}"
ToolTip="{TemplateBinding CsharpUrl}" />
<TextBlock
Grid.Row="3"
Margin="0,24,0,12"
FontSize="18"
FontWeight="DemiBold"
Text="Documentation" />
<ui:Hyperlink
Grid.Row="4"
Content="API documentation"
NavigateUri="https://wpfui.lepo.co/documentation/" />
<TextBlock
Grid.Row="5"
Margin="0,24,0,12"
FontSize="18"
FontWeight="DemiBold"
Text="Feedback" />
<ui:Hyperlink
Grid.Row="6"
Content="Send feedback about this page"
NavigateUri="https://github.com/lepoco/wpfui/issues/new?assignees=pomianowski&amp;labels=bug,gallery&amp;template=bug_report.yaml&amp;title=WPF+UI+Gallery+Problem" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
......@@ -2,8 +2,11 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls"
xmlns:helpers="clr-namespace:Wpf.Ui.Gallery.Helpers"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<helpers:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
<Style TargetType="{x:Type controls:ControlExample}">
<Setter Property="Focusable" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
......@@ -15,21 +18,31 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border
<ui:TextBlock
Grid.Row="0"
Margin="0,0,0,10"
FontTypography="BodyStrong"
Text="{TemplateBinding HeaderText}"
Visibility="{TemplateBinding HeaderText,
Converter={StaticResource NullToVisibilityConverter}}" />
<Border
Grid.Row="1"
Padding="10"
Background="{ui:ThemeResource CardStrokeColorDefaultBrush}"
BorderBrush="{ui:ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
BorderBrush="{ui:ThemeResource ControlElevationBorderBrush}"
BorderThickness="1,1,1,0"
CornerRadius="8,8,0,0">
<ContentPresenter Content="{TemplateBinding ExampleContent}" />
</Border>
<ui:CardExpander
Grid.Row="1"
Grid.Row="2"
Background="{ui:ThemeResource CardBackgroundFillColorSecondaryBrush}"
CornerRadius="0,0,8,8"
Header="Source code">
<StackPanel>
<StackPanel x:Name="XamlCodeBlock">
......
......@@ -10,29 +10,61 @@ namespace Wpf.Ui.Gallery.Controls;
[ContentProperty(nameof(ExampleContent))]
public class ControlExample : Control
{
public static readonly DependencyProperty ExampleContentProperty =
DependencyProperty.Register(nameof(ExampleContent),
typeof(object), typeof(ControlExample), new PropertyMetadata(null));
public static readonly DependencyProperty XamlCodeProperty =
DependencyProperty.Register(nameof(XamlCode),
typeof(string), typeof(ControlExample), new PropertyMetadata(null));
public static readonly DependencyProperty XamlCodeSourceProperty =
DependencyProperty.Register(nameof(XamlCodeSource),
typeof(Uri), typeof(ControlExample),
new PropertyMetadata(null,
static (o, args) => ((ControlExample)o).OnXamlCodeSourceChanged((Uri)args.NewValue)));
public static readonly DependencyProperty CsharpCodeProperty =
DependencyProperty.Register(nameof(CsharpCode),
typeof(string), typeof(ControlExample), new PropertyMetadata(null));
public static readonly DependencyProperty HeaderTextProperty = DependencyProperty.Register(
nameof(HeaderText),
typeof(string),
typeof(ControlExample),
new PropertyMetadata(null)
);
public static readonly DependencyProperty ExampleContentProperty = DependencyProperty.Register(
nameof(ExampleContent),
typeof(object),
typeof(ControlExample),
new PropertyMetadata(null)
);
public static readonly DependencyProperty XamlCodeProperty = DependencyProperty.Register(
nameof(XamlCode),
typeof(string),
typeof(ControlExample),
new PropertyMetadata(null)
);
public static readonly DependencyProperty XamlCodeSourceProperty = DependencyProperty.Register(
nameof(XamlCodeSource),
typeof(Uri),
typeof(ControlExample),
new PropertyMetadata(
null,
static (o, args) => ((ControlExample)o).OnXamlCodeSourceChanged((Uri)args.NewValue)
)
);
public static readonly DependencyProperty CsharpCodeProperty = DependencyProperty.Register(
nameof(CsharpCode),
typeof(string),
typeof(ControlExample),
new PropertyMetadata(null)
);
public static readonly DependencyProperty CsharpCodeSourceProperty =
DependencyProperty.Register(nameof(CsharpCodeSource),
typeof(Uri), typeof(ControlExample),
new PropertyMetadata(null,
static (o, args) => ((ControlExample)o).OnCsharpCodeSourceChanged((Uri)args.NewValue)));
DependencyProperty.Register(
nameof(CsharpCodeSource),
typeof(Uri),
typeof(ControlExample),
new PropertyMetadata(
null,
static (o, args) =>
((ControlExample)o).OnCsharpCodeSourceChanged((Uri)args.NewValue)
)
);
public string? HeaderText
{
get => (string)GetValue(HeaderTextProperty);
set => SetValue(HeaderTextProperty, value);
}
public object? ExampleContent
{
......@@ -83,7 +115,6 @@ private static string LoadResource(Uri uri)
using StreamReader streamReader = new(steamInfo.Stream, Encoding.UTF8);
return streamReader.ReadToEnd();
}
catch (Exception e)
{
......
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System;
using System.Windows;
namespace Wpf.Ui.Gallery.Controls;
public class GalleryControlPresenter : System.Windows.Controls.ContentControl
{
/// <summary>
/// Property for <see cref="HeaderText"/>.
/// </summary>
public static readonly DependencyProperty HeaderTextProperty =
DependencyProperty.Register(nameof(HeaderText),
typeof(string), typeof(GalleryControlPresenter), new PropertyMetadata(String.Empty));
/// <summary>
/// Property for <see cref="CodeText"/>.
/// </summary>
public static readonly DependencyProperty CodeTextProperty =
DependencyProperty.Register(nameof(CodeText),
typeof(string), typeof(GalleryControlPresenter), new PropertyMetadata(String.Empty));
public string HeaderText
{
get => (string)GetValue(HeaderTextProperty);
set => SetValue(HeaderTextProperty, value);
}
public string CodeText
{
get => (string)GetValue(CodeTextProperty);
set => SetValue(CodeTextProperty, value);
}
}
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<Style TargetType="{x:Type controls:GalleryControlPresenter}">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="Focusable" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:GalleryControlPresenter}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock
x:Name="Header"
Grid.Row="0"
Margin="0"
FontSize="18"
FontWeight="DemiBold"
Text="{TemplateBinding HeaderText}" />
<ui:Card Grid.Row="1" Margin="0,8,0,0">
<ContentPresenter Content="{TemplateBinding Content}" />
</ui:Card>
<ui:CodeBlock
x:Name="CodeBlock"
Grid.Row="2"
Margin="0,4,0,0"
Content="{TemplateBinding CodeText}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HeaderText" Value="{x:Null}">
<Setter TargetName="Header" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="HeaderText" Value="">
<Setter TargetName="Header" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="CodeText" Value="{x:Null}">
<Setter TargetName="CodeBlock" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="CodeText" Value="">
<Setter TargetName="CodeBlock" Property="Visibility" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -21,9 +21,11 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Command="{Binding TemplateButtonCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:GalleryNavigationPresenter}, Mode=OneWay}"
CommandParameter="{Binding Link, Mode=OneTime}"
Icon="{Binding Icon, Mode=OneTime}"
CommandParameter="{Binding PageType, Mode=OneTime}"
IsChevronVisible="True">
<ui:CardAction.Icon>
<ui:SymbolIcon FontSize="30" Symbol="{Binding Icon, Mode=OneTime}" />
</ui:CardAction.Icon>
<StackPanel>
<ui:TextBlock
Margin="0"
......@@ -42,7 +44,7 @@
<ItemsPanelTemplate>
<ui:VirtualizingWrapPanel
IsItemsHost="True"
ItemSize="290,70"
ItemSize="290,80"
Orientation="Vertical"
SpacingMode="Uniform"
StretchItems="True" />
......
......@@ -4,7 +4,6 @@
// All Rights Reserved.
using System.Windows;
using Wpf.Ui.Gallery.Helpers;
namespace Wpf.Ui.Gallery.Controls;
......@@ -13,16 +12,23 @@ public class GalleryNavigationPresenter : System.Windows.Controls.Control
/// <summary>
/// Property for <see cref="ItemsSource"/>.
/// </summary>
public static readonly DependencyProperty ItemsSourceProperty =
DependencyProperty.Register(nameof(ItemsSource),
typeof(object), typeof(GalleryNavigationPresenter), new PropertyMetadata(null));
public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(
nameof(ItemsSource),
typeof(object),
typeof(GalleryNavigationPresenter),
new PropertyMetadata(null)
);
/// <summary>
/// Property for <see cref="TemplateButtonCommand"/>.
/// </summary>
public static readonly DependencyProperty TemplateButtonCommandProperty =
DependencyProperty.Register(nameof(TemplateButtonCommand),
typeof(Common.IRelayCommand), typeof(GalleryNavigationPresenter), new PropertyMetadata(null));
DependencyProperty.Register(
nameof(TemplateButtonCommand),
typeof(Common.IRelayCommand),
typeof(GalleryNavigationPresenter),
new PropertyMetadata(null)
);
public object ItemsSource
{
......@@ -33,30 +39,35 @@ public object ItemsSource
/// <summary>
/// Command triggered after clicking the titlebar button.
/// </summary>
public Common.IRelayCommand TemplateButtonCommand => (Common.IRelayCommand)GetValue(TemplateButtonCommandProperty);
public Common.IRelayCommand TemplateButtonCommand =>
(Common.IRelayCommand)GetValue(TemplateButtonCommandProperty);
/// <summary>
/// Creates a new instance of the class and sets the default <see cref="FrameworkElement.Loaded"/> event.
/// </summary>
public GalleryNavigationPresenter()
{
SetValue(TemplateButtonCommandProperty, new Common.RelayCommand<string>(o => OnTemplateButtonClick(o ?? String.Empty)));
SetValue(
TemplateButtonCommandProperty,
new Common.RelayCommand<Type>(o => OnTemplateButtonClick(o))
);
}
private void OnTemplateButtonClick(string parameter)
private void OnTemplateButtonClick(Type? pageType)
{
var navigationService = App.GetService<INavigationService>();
if (navigationService == null)
return;
var pageType = NameToPageTypeConverter.Convert(parameter);
if (pageType != null)
if (pageType is not null)
navigationService.Navigate(pageType);
#if DEBUG
System.Diagnostics.Debug.WriteLine($"INFO | {nameof(GalleryNavigationPresenter)} navigated, {parameter} ({pageType})", "Wpf.Ui.Gallery");
System.Diagnostics.Debug.WriteLine(
$"INFO | {nameof(GalleryNavigationPresenter)} navigated, ({pageType})",
"Wpf.Ui.Gallery"
);
#endif
}
}
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<Style TargetType="{x:Type controls:PageControlDocumentation}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:PageControlDocumentation}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<ui:Button
Margin="0,0,5,0"
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
CommandParameter="doc"
Content="Documentation"
Icon="{ui:SymbolIcon Document24}"
Visibility="{TemplateBinding IsDocumentationLinkVisible}" />
<ui:Button
Margin="0,0,5,0"
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
CommandParameter="xaml"
Content="XAML source code" />
<ui:Button
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
CommandParameter="c#"
Content="C# source code" />
</StackPanel>
<ui:Button
Grid.Column="1"
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
CommandParameter="theme"
Icon="{ui:SymbolIcon WeatherSunny24}"
ToolTip="Toggle theme" />
<Separator
Grid.Column="2"
Height="16"
Margin="4,0,4,0" />
<ui:Button
Grid.Column="3"
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
CommandParameter="copy"
Icon="{ui:SymbolIcon Link24}"
ToolTip="Copy link" />
<ui:Anchor
Grid.Column="4"
Margin="4,0,0,0"
Icon="{ui:SymbolIcon PersonFeedback24}"
NavigateUri="https://github.com/lepoco/wpfui/issues/new?assignees=pomianowski&amp;labels=bug,gallery&amp;template=bug_report.yaml&amp;title=WPF+UI+Gallery+Problem"
ToolTip="Send feedback" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Gallery.Controls;
public class PageControlDocumentation : Control
{
public static readonly DependencyProperty ShowProperty = DependencyProperty.RegisterAttached(
"Show",
typeof(bool),
typeof(FrameworkElement),
new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender)
);
public static readonly DependencyProperty DocumentationTypeProperty =
DependencyProperty.RegisterAttached(
"DocumentationType",
typeof(Type),
typeof(FrameworkElement),
new FrameworkPropertyMetadata(null)
);
public static bool GetShow(FrameworkElement target) => (bool)target.GetValue(ShowProperty);
public static void SetShow(FrameworkElement target, bool show) =>
target.SetValue(ShowProperty, show);
public static Type? GetDocumentationType(FrameworkElement target) =>
(Type?)target.GetValue(DocumentationTypeProperty);
public static void SetDocumentationType(FrameworkElement target, Type type) =>
target.SetValue(DocumentationTypeProperty, type);
public static readonly DependencyProperty NavigationViewProperty = DependencyProperty.Register(
nameof(NavigationView),
typeof(INavigationView),
typeof(PageControlDocumentation),
new FrameworkPropertyMetadata(null)
);
public static readonly DependencyProperty IsDocumentationLinkVisibleProperty =
DependencyProperty.Register(
nameof(IsDocumentationLinkVisible),
typeof(Visibility),
typeof(PageControlDocumentation),
new FrameworkPropertyMetadata(Visibility.Collapsed)
);
public static readonly DependencyProperty TemplateButtonCommandProperty =
DependencyProperty.Register(
nameof(TemplateButtonCommand),
typeof(ICommand),
typeof(PageControlDocumentation),
new PropertyMetadata(null)
);
public INavigationView? NavigationView
{
get => (INavigationView)GetValue(NavigationViewProperty);
set => SetValue(NavigationViewProperty, value);
}
public Visibility IsDocumentationLinkVisible
{
get => (Visibility)GetValue(IsDocumentationLinkVisibleProperty);
set => SetValue(IsDocumentationLinkVisibleProperty, value);
}
public ICommand TemplateButtonCommand => (ICommand)GetValue(TemplateButtonCommandProperty);
public PageControlDocumentation()
{
Loaded += static (sender, _) => ((PageControlDocumentation)sender).OnLoaded();
Unloaded += static (sender, _) => ((PageControlDocumentation)sender).OnUnloaded();
SetValue(
TemplateButtonCommandProperty,
new CommunityToolkit.Mvvm.Input.RelayCommand<string>(OnClick)
);
}
private FrameworkElement? _page;
private void OnLoaded()
{
if (NavigationView is null)
throw new ArgumentNullException(nameof(NavigationView));
NavigationView.Navigated += NavigationViewOnNavigated;
}
private void OnUnloaded()
{
NavigationView!.Navigated -= NavigationViewOnNavigated;
_page = null;
}
private void NavigationViewOnNavigated(NavigationView sender, NavigatedEventArgs args)
{
IsDocumentationLinkVisible = Visibility.Collapsed;
if (args.Page is not FrameworkElement page || !GetShow(page))
{
Visibility = Visibility.Collapsed;
return;
}
_page = page;
Visibility = Visibility.Visible;
if (GetDocumentationType(page) is not null)
IsDocumentationLinkVisible = Visibility.Visible;
}
private void OnClick(string? param)
{
if (string.IsNullOrWhiteSpace(param) || _page is null)
return;
// TODO: Refactor switch
if (param == "theme")
{
SwitchThemes();
return;
}
string navigationUrl = param switch
{
"doc" when GetDocumentationType(_page) is { } documentationType
=> CreateUrlForDocumentation(documentationType),
"xaml" => CreateUrlForGithub(_page.GetType(), ".xaml"),
"c#" => CreateUrlForGithub(_page.GetType(), ".xaml.cs"),
_ => String.Empty
};
if (String.IsNullOrEmpty(navigationUrl))
return;
try
{
ProcessStartInfo sInfo = new(navigationUrl) { UseShellExecute = true };
Process.Start(sInfo);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
private static string CreateUrlForGithub(Type pageType, ReadOnlySpan<char> fileExtension)
{
const string baseUrl = "https://github.com/lepoco/wpfui/tree/main/src/Wpf.Ui.Gallery/";
const string baseNamespace = "Wpf.Ui.Gallery";
var pageFullNameWithoutBaseNamespace = pageType.FullName
.AsSpan()
.Slice(baseNamespace.Length + 1);
Span<char> pageUrl = stackalloc char[pageFullNameWithoutBaseNamespace.Length];
pageFullNameWithoutBaseNamespace.CopyTo(pageUrl);
for (int i = 0; i < pageUrl.Length; i++)
{
if (pageUrl[i] == '.')
pageUrl[i] = '/';
}
return string.Concat(baseUrl, pageUrl, fileExtension);
}
private static string CreateUrlForDocumentation(Type type)
{
const string baseUrl = "https://wpfui.lepo.co/documentation/";
return string.Concat(baseUrl, type.FullName, ".html");
}
private static void SwitchThemes()
{
var currentTheme = Wpf.Ui.Appearance.Theme.GetAppTheme();
Wpf.Ui.Appearance.Theme.Apply(
currentTheme == Wpf.Ui.Appearance.ThemeType.Light
? Wpf.Ui.Appearance.ThemeType.Dark
: Wpf.Ui.Appearance.ThemeType.Light
);
}
}
using System.Windows;
using System.Windows.Controls;
using Wpf.Ui.Controls.ContentDialogControl;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Gallery.Controls;
......@@ -17,7 +17,8 @@ protected override void OnButtonClick(ContentDialogButton button)
{
base.OnButtonClick(button);
return;
};
}
;
TextBlock.Visibility = Visibility.Visible;
CheckBox.Focus();
......
......@@ -5,28 +5,48 @@ namespace Wpf.Ui.Gallery.Controls;
public class TypographyControl : Control
{
public static readonly DependencyProperty ExampleProperty =
DependencyProperty.Register(nameof(Example),
typeof(string), typeof(TypographyControl), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty ExampleProperty = DependencyProperty.Register(
nameof(Example),
typeof(string),
typeof(TypographyControl),
new PropertyMetadata(string.Empty)
);
public static readonly DependencyProperty ExampleFontTypographyProperty =
DependencyProperty.Register(nameof(ExampleFontTypography),
typeof(FontTypography), typeof(TypographyControl),
new PropertyMetadata(FontTypography.Body,
DependencyProperty.Register(
nameof(ExampleFontTypography),
typeof(FontTypography),
typeof(TypographyControl),
new PropertyMetadata(
FontTypography.Body,
static (o, args) =>
((TypographyControl)o).OnExampleFontTypographyChanged((FontTypography)args.NewValue)));
((TypographyControl)o).OnExampleFontTypographyChanged(
(FontTypography)args.NewValue
)
)
);
public static readonly DependencyProperty VariableFontProperty =
DependencyProperty.Register(nameof(VariableFont),
typeof(string), typeof(TypographyControl), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty VariableFontProperty = DependencyProperty.Register(
nameof(VariableFont),
typeof(string),
typeof(TypographyControl),
new PropertyMetadata(string.Empty)
);
public static readonly DependencyProperty SizeLinHeightProperty =
DependencyProperty.Register(nameof(SizeLinHeight),
typeof(string), typeof(TypographyControl), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty SizeLinHeightProperty = DependencyProperty.Register(
nameof(SizeLinHeight),
typeof(string),
typeof(TypographyControl),
new PropertyMetadata(string.Empty)
);
public static readonly DependencyProperty FontTypographyStyleProperty =
DependencyProperty.Register(nameof(FontTypographyStyle),
typeof(string), typeof(TypographyControl), new PropertyMetadata(FontTypography.Body.ToString()));
DependencyProperty.Register(
nameof(FontTypographyStyle),
typeof(string),
typeof(TypographyControl),
new PropertyMetadata(FontTypography.Body.ToString())
);
public string Example
{
......
using System.Reflection;
namespace Wpf.Ui.Gallery.ControlsLookup;
static class ControlPages
{
private const string PageSuffix = "Page";
public static IEnumerable<GalleryPage> All()
{
foreach (
var type in GalleryAssembly.Asssembly
.GetTypes()
.Where(t => t.IsDefined(typeof(GalleryPageAttribute)))
)
{
var galleryPageAttribute = type.GetCustomAttributes<GalleryPageAttribute>()
.FirstOrDefault();
if (galleryPageAttribute is not null)
{
yield return new GalleryPage(
type.Name.Substring(0, type.Name.LastIndexOf(PageSuffix)),
galleryPageAttribute.Description,
galleryPageAttribute.Icon,
type
);
}
}
}
public static IEnumerable<GalleryPage> FromNamespace(string namespaceName)
{
return All().Where(t => t.PageType?.Namespace?.StartsWith(namespaceName) ?? false);
}
}
namespace Wpf.Ui.Gallery.ControlsLookup;
record GalleryPage(string Name, string Description, SymbolRegular Icon, Type PageType);
namespace Wpf.Ui.Gallery.ControlsLookup;
[AttributeUsage(AttributeTargets.Class)]
class GalleryPageAttribute : Attribute
{
public string Description { get; }
public SymbolRegular Icon { get; }
public GalleryPageAttribute(string description, SymbolRegular icon)
{
Description = description;
Icon = icon;
}
}
using System.Reflection;
namespace Wpf.Ui.Gallery;
class GalleryAssembly
{
public static Assembly Asssembly => Assembly.GetExecutingAssembly();
}
......@@ -13,7 +13,7 @@ internal class EnumToBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter is not String enumString)
if (parameter is not string enumString)
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName");
if (!Enum.IsDefined(typeof(Wpf.Ui.Appearance.ThemeType), value))
......@@ -26,7 +26,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter is not String enumString)
if (parameter is not string enumString)
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName");
return Enum.Parse(typeof(Wpf.Ui.Appearance.ThemeType), enumString);
......
......@@ -21,6 +21,8 @@ internal class NameToPageTypeConverter
{
pageName = pageName.Trim().ToLower() + "page";
return PageTypes.FirstOrDefault(singlePageType => singlePageType.Name.ToLower() == pageName);
return PageTypes.FirstOrDefault(
singlePageType => singlePageType.Name.ToLower() == pageName
);
}
}
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Wpf.Ui.Gallery.Helpers;
public class NullToVisibilityConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object parameter, CultureInfo culture) =>
value is null ? Visibility.Collapsed : Visibility.Visible;
public object ConvertBack(
object value,
Type targetType,
object parameter,
CultureInfo culture
) => throw new NotImplementedException();
}
......@@ -85,5 +85,4 @@ public enum MonacoLanguage
Vb,
Xml,
Yaml,
}
......@@ -13,5 +13,5 @@ public record NavigationCard
public string Description { get; init; }
public string Link { get; init; }
public Type PageType { get; init; }
}
......@@ -22,5 +22,4 @@ public class Product
public int UnitsInStock { get; set; }
public bool IsVirtual { get; set; }
}
......@@ -19,7 +19,9 @@ public WindowsProviderService(IServiceProvider serviceProvider)
public void Show<T>() where T : class
{
if (!typeof(Window).IsAssignableFrom(typeof(T)))
throw new InvalidOperationException($"The window class should be derived from {typeof(Window)}.");
throw new InvalidOperationException(
$"The window class should be derived from {typeof(Window)}."
);
var windowInstance = _serviceProvider.GetService<T>() as Window;
......
......@@ -4,6 +4,7 @@
// All Rights Reserved.
using System.Collections.ObjectModel;
using Wpf.Ui.Gallery.ControlsLookup;
using Wpf.Ui.Gallery.Models;
namespace Wpf.Ui.Gallery.ViewModels.Pages;
......@@ -11,333 +12,19 @@ namespace Wpf.Ui.Gallery.ViewModels.Pages;
public partial class AllControlsViewModel : ObservableObject
{
[ObservableProperty]
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>
{
new()
{
Name = "Anchor",
Icon = SymbolRegular.CubeLink20,
Description = "Button which opens a link.",
Link = "Anchor"
},
new()
{
Name = "Button",
Icon = SymbolRegular.ControlButton24,
Description = "Simple button.",
Link = "Button"
},
new()
{
Name = "Hyperlink",
Icon = SymbolRegular.Link24,
Description = "Opens a link.",
Link = "Hyperlink"
},
new()
{
Name = "ToggleButton",
Icon = SymbolRegular.ToggleRight24,
Description = "Toggleable button.",
Link = "ToggleButton"
},
new()
{
Name = "ToggleSwitch",
Icon = SymbolRegular.ToggleLeft24,
Description = "Switchable button with a ball.",
Link = "ToggleSwitch"
},
new()
{
Name = "CheckBox",
Icon = SymbolRegular.CheckmarkSquare24,
Description = "Button with binary choice.",
Link = "CheckBox"
},
new()
{
Name = "ComboBox",
Icon = SymbolRegular.Filter16,
Description = "Button with binary choice.",
Link = "ComboBox"
},
new()
{
Name = "RadioButton",
Icon = SymbolRegular.RadioButton24,
Description = "Set of options as buttons.",
Link = "RadioButton"
},
new()
{
Name = "RatingControl",
Icon = SymbolRegular.Star24,
Description = "Rating using stars.",
Link = "Rating"
},
new()
{
Name = "ThumbRate",
Icon = SymbolRegular.ThumbLike24,
Description = "Like or dislike.",
Link = "ThumbRate"
},
new()
{
Name = "Slider",
Icon = SymbolRegular.HandDraw24,
Description = "Sliding control.",
Link = "Slider"
},
new()
{
Name = "DataGrid",
Icon = SymbolRegular.GridKanban20,
Description = "Complex data presenter.",
Link = "DataGrid"
},
new()
{
Name = "ListBox",
Icon = SymbolRegular.AppsListDetail24,
Description = "Selectable list.",
Link = "ListBox"
},
new()
{
Name = "ListView",
Icon = SymbolRegular.GroupList24,
Description = "Selectable list.",
Link = "ListView"
},
new()
{
Name = "TreeView",
Icon = SymbolRegular.TextBulletListTree24,
Description = "Collapsable list.",
Link = "TreeView"
},
#if DEBUG
new()
{
Name = "TreeList",
Icon = SymbolRegular.TextBulletListTree24,
Description = "List inside the TreeView.",
Link = "TreeList"
},
#endif
new()
{
Name = "Calendar",
Icon = SymbolRegular.CalendarLtr24,
Description = "Presents a calendar to the user.",
Link = "Calendar"
},
new()
{
Name = "DatePicker",
Icon = SymbolRegular.CalendarSearch20,
Description = "Control that lets pick a date.",
Link = "DatePicker"
},
new()
{
Name = "Snackbar",
Icon = SymbolRegular.PlayingCards20,
Description = "Information card at the bottom.",
Link = "Snackbar"
},
new()
{
Name = "Dialog",
Icon = SymbolRegular.CalendarMultiple24,
Description = "Card covering the app content",
Link = "Dialog"
},
new()
{
Name = "Flyout",
Icon = SymbolRegular.AppTitle24,
Description = "Contextual popup.",
Link = "Flyout"
},
new()
{
Name = "MessageBox",
Icon = SymbolRegular.CalendarInfo20,
Description = "MessageBox",
Link = "MessageBox"
},
new()
{
Name = "Image",
Icon = SymbolRegular.ImageMultiple24,
Description = "Image presenter.",
Link = "Image"
},
new()
{
Name = "Canvas",
Icon = SymbolRegular.InkStroke24,
Description = "Canvas presenter.",
Link = "Canvas"
},
new()
{
Name = "WebView",
Icon = SymbolRegular.GlobeDesktop24,
Description = "Embedded browser window.",
Link = "WebView"
},
new()
{
Name = "WebBrowser",
Icon = SymbolRegular.GlobeProhibited20,
Description = "(Obsolete) Embedded browser.",
Link = "WebBrowser"
},
new()
{
Name = "BreadcrumbBar",
Icon = SymbolRegular.Navigation24,
Description = "Shows the trail of navigation taken to the current location.",
Link = "BreadcrumbBar"
},
new()
{
Name = "NavigationView",
Icon = SymbolRegular.PanelLeft24,
Description = "Main navigation for the app.",
Link = "NavigationView"
},
new()
{
Name = "Multilevel Navigation",
Icon = SymbolRegular.PanelRightContract24,
Description = "Navigation with multi level Breadcrumb.",
Link = "NavigationView"
},
new()
{
Name = "Menu",
Icon = SymbolRegular.RowTriple24,
Description = "Contains a collection of MenuItem elements.",
Link = "Menu"
},
new()
{
Name = "TabControl",
Icon = SymbolRegular.TabDesktopBottom24,
Description = "Tab control like in browser.",
Link = "TabControl"
},
new()
{
Name = "TabView",
Icon = SymbolRegular.TabDesktop24,
Description = "Display a set of tabs.",
Link = "TabView"
},
new()
{
Name = "InfoBar",
Icon = SymbolRegular.ErrorCircle24,
Description = "Inline message card.",
Link = "InfoBar"
},
new()
{
Name = "ProgressBar",
Icon = SymbolRegular.ArrowDownload24,
Description = "Shows the app progress on a task.",
Link = "ProgressBar"
},
new()
{
Name = "ProgressRing",
Icon = SymbolRegular.ArrowClockwise24,
Description = "Shows the app progress on a task.",
Link = "ProgressRing"
},
new()
{
Name = "ToolTip",
Icon = SymbolRegular.Comment24,
Description = "Information in popup window.",
Link = "ToolTip"
},
new()
{
Name = "AutoSuggestBox",
Icon = SymbolRegular.TextBulletListSquare24,
Description = "Control with suggestions.",
Link = "AutoSuggestBox"
},
new()
{
Name = "NumberBox",
Icon = SymbolRegular.NumberSymbol24,
Description = "Control for numeric input.",
Link = "NumberBox"
},
new()
{
Name = "PasswordBox",
Icon = SymbolRegular.Password24,
Description = "A control for entering passwords.",
Link = "PasswordBox"
},
new()
{
Name = "RichTextBox",
Icon = SymbolRegular.DrawText24,
Description = "A rich editing control.",
Link = "RichTextBox"
},
new()
{
Name = "Label",
Icon = SymbolRegular.TextBaseline20,
Description = "Caption of an item.",
Link = "Label"
},
new()
{
Name = "TextBlock",
Icon = SymbolRegular.TextCaseLowercase24,
Description = "Control for displaying text.",
Link = "TextBlock"
},
new()
{
Name = "TextBox",
Icon = SymbolRegular.TextColor24,
Description = "Plain text field.",
Link = "TextBox"
},
new()
{
Name = "SymbolIcon",
Icon = SymbolRegular.Fluent24,
Description = "Single icon.",
Link = "SymbolIcon"
},
new()
{
Name = "FontIcon",
Icon = SymbolRegular.TextFont24,
Description = "Control displaying a single font glyph.",
Link = "FontIcon"
},
#if DEBUG
new()
{
Name = "Expander",
Icon = SymbolRegular.Code24,
Description = "Expander control.",
Link = "Expander"
}
#endif
};
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>(
ControlPages
.All()
.Select(
x =>
new NavigationCard()
{
Name = x.Name,
Icon = x.Icon,
Description = x.Description,
PageType = x.PageType
}
)
.OrderBy(x => x.Name)
);
}
......@@ -4,8 +4,6 @@
// All Rights Reserved.
using System.Windows.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace Wpf.Ui.Gallery.ViewModels.Pages.BasicInput;
......@@ -14,7 +12,6 @@ public partial class AnchorViewModel : ObservableObject
[ObservableProperty]
private bool _isAnchorEnabled = true;
[RelayCommand]
private void OnAnchorCheckboxChecked(object sender)
{
......
......@@ -4,91 +4,27 @@
// All Rights Reserved.
using System.Collections.ObjectModel;
using Wpf.Ui.Gallery.ControlsLookup;
using Wpf.Ui.Gallery.Models;
using Wpf.Ui.Gallery.Views.Pages.BasicInput;
namespace Wpf.Ui.Gallery.ViewModels.Pages.BasicInput;
public partial class BasicInputViewModel : ObservableObject
{
[ObservableProperty]
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>
{
new()
{
Name = "Anchor",
Icon = SymbolRegular.CubeLink20,
Description = "Button which opens a link.",
Link = "Anchor"
},
new()
{
Name = "Button",
Icon = SymbolRegular.ControlButton24,
Description = "Simple button.",
Link = "Button"
},
new()
{
Name = "Hyperlink",
Icon = SymbolRegular.Link24,
Description = "Opens a link.",
Link = "Hyperlink"
},
new()
{
Name = "ToggleButton",
Icon = SymbolRegular.ToggleRight24,
Description = "Toggleable button.",
Link = "ToggleButton"
},
new()
{
Name = "ToggleSwitch",
Icon = SymbolRegular.ToggleLeft24,
Description = "Switchable button with a ball.",
Link = "ToggleSwitch"
},
new()
{
Name = "CheckBox",
Icon = SymbolRegular.CheckmarkSquare24,
Description = "Button with binary choice.",
Link = "CheckBox"
},
new()
{
Name = "ComboBox",
Icon = SymbolRegular.Filter16,
Description = "Button with binary choice.",
Link = "ComboBox"
},
new()
{
Name = "RadioButton",
Icon = SymbolRegular.RadioButton24,
Description = "Set of options as buttons.",
Link = "RadioButton"
},
new()
{
Name = "RatingControl",
Icon = SymbolRegular.Star24,
Description = "Rating using stars.",
Link = "Rating"
},
new()
{
Name = "ThumbRate",
Icon = SymbolRegular.ThumbLike24,
Description = "Like or dislike.",
Link = "ThumbRate"
},
new()
{
Name = "Slider",
Icon = SymbolRegular.HandDraw24,
Description = "Sliding control.",
Link = "Slider"
}
};
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>(
ControlPages
.FromNamespace(typeof(BasicInputPage).Namespace!)
.Select(
x =>
new NavigationCard()
{
Name = x.Name,
Icon = x.Icon,
Description = x.Description,
PageType = x.PageType
}
)
);
}
......@@ -30,9 +30,9 @@ private void OnSelectAllChecked(object sender)
return;
if (checkBox.IsChecked == null)
checkBox.IsChecked = !(OptionOneCheckBoxChecked &&
OptionTwoCheckBoxChecked &&
OptionThreeCheckBoxChecked);
checkBox.IsChecked = !(
OptionOneCheckBoxChecked && OptionTwoCheckBoxChecked && OptionThreeCheckBoxChecked
);
if (checkBox.IsChecked == true)
{
......@@ -53,7 +53,9 @@ private void OnSingleChecked(string option)
{
if (OptionOneCheckBoxChecked && OptionTwoCheckBoxChecked && OptionThreeCheckBoxChecked)
SelectAllCheckBoxChecked = true;
else if (!OptionOneCheckBoxChecked && !OptionTwoCheckBoxChecked && !OptionThreeCheckBoxChecked)
else if (
!OptionOneCheckBoxChecked && !OptionTwoCheckBoxChecked && !OptionThreeCheckBoxChecked
)
SelectAllCheckBoxChecked = false;
else
SelectAllCheckBoxChecked = null;
......
......@@ -14,7 +14,6 @@ public partial class HyperlinkViewModel : ObservableObject
[ObservableProperty]
private bool _isHyperlinkEnabled = true;
[RelayCommand]
private void OnHyperlinkCheckboxChecked(object sender)
{
......
......@@ -4,7 +4,6 @@
// All Rights Reserved.
using Wpf.Ui.Controls;
using Wpf.Ui.Controls.ThumbRateControl;
namespace Wpf.Ui.Gallery.ViewModels.Pages.BasicInput;
......@@ -31,7 +30,8 @@ public ThumbRateState ThumbRateState
_ => "None"
};
ThumRateStateCodeText = $"<ui:ThumbRate State=\"{(value switch
ThumRateStateCodeText =
$"<ui:ThumbRate State=\"{(value switch
{
ThumbRateState.Liked => "Liked",
ThumbRateState.Disliked => "Disliked",
......
......@@ -14,7 +14,6 @@ public partial class ToggleButtonViewModel : ObservableObject
[ObservableProperty]
private bool _isToggleButtonEnabled = true;
[RelayCommand]
private void OnToggleButtonCheckboxChecked(object sender)
{
......
......@@ -14,7 +14,6 @@ public partial class ToggleSwitchViewModel : ObservableObject
[ObservableProperty]
private bool _isToggleSwitchEnabled = true;
[RelayCommand]
private void OnToggleSwitchCheckboxChecked(object sender)
{
......
......@@ -3,53 +3,28 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System.Collections.Generic;
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using Wpf.Ui.Common;
using Wpf.Ui.Gallery.ControlsLookup;
using Wpf.Ui.Gallery.Models;
using Wpf.Ui.Gallery.Views.Pages.Collections;
namespace Wpf.Ui.Gallery.ViewModels.Pages.Collections;
public partial class CollectionsViewModel : ObservableObject
{
[ObservableProperty]
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>
{
new()
{
Name = "DataGrid",
Icon = SymbolRegular.GridKanban20,
Description = "Complex data presenter.",
Link = "DataGrid"
},
new()
{
Name = "ListBox",
Icon = SymbolRegular.AppsListDetail24,
Description = "Selectable list.",
Link = "ListBox"
},
new()
{
Name = "ListView",
Icon = SymbolRegular.GroupList24,
Description = "Selectable list.",
Link = "ListView"
},
new()
{
Name = "TreeView",
Icon = SymbolRegular.TextBulletListTree24,
Description = "Collapsable list.",
Link = "TreeView"
},
new()
{
Name = "TreeList",
Icon = SymbolRegular.TextBulletListTree24,
Description = "List inside the TreeView.",
Link = "TreeList"
},
};
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>(
ControlPages
.FromNamespace(typeof(CollectionsPage).Namespace!)
.Select(
x =>
new NavigationCard()
{
Name = x.Name,
Icon = x.Icon,
Description = x.Description,
PageType = x.PageType
}
)
);
}
using System;
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Wpf.Ui.Gallery.Models;
namespace Wpf.Ui.Gallery.ViewModels.Pages.Collections;
public partial class DataGridViewModel : ObservableObject
{
[ObservableProperty] private ObservableCollection<Product> _productsCollection;
[ObservableProperty]
private ObservableCollection<Product> _productsCollection;
public DataGridViewModel()
{
......@@ -25,15 +24,20 @@ private ObservableCollection<Product> GenerateProducts()
for (int i = 0; i < 50; i++)
{
products.Add(new Product
{
ProductId = i,
ProductCode = i,
ProductName = adjectives[random.Next(0, adjectives.Length)] + " " + names[random.Next(0, names.Length)],
UnitPrice = Math.Round(random.NextDouble() * 20.0, 3),
UnitsInStock = random.Next(0, 100),
IsVirtual = random.Next(0, 2) == 1
});
products.Add(
new Product
{
ProductId = i,
ProductCode = i,
ProductName =
adjectives[random.Next(0, adjectives.Length)]
+ " "
+ names[random.Next(0, names.Length)],
UnitPrice = Math.Round(random.NextDouble() * 20.0, 3),
UnitsInStock = random.Next(0, 100),
IsVirtual = random.Next(0, 2) == 1
}
);
}
return products;
......
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
namespace Wpf.Ui.Gallery.ViewModels.Pages.Collections;
......@@ -10,6 +9,13 @@ public partial class ListBoxViewModel : ObservableObject
public ListBoxViewModel()
{
_listBoxItems = new ObservableCollection<string> { "Arial", "Comic Sans MS", "Courier New", "Segoe UI", "Times New Roman" };
_listBoxItems = new ObservableCollection<string>
{
"Arial",
"Comic Sans MS",
"Courier New",
"Segoe UI",
"Times New Roman"
};
}
}
......@@ -39,15 +39,58 @@ private ObservableCollection<Person> GeneratePersons()
var random = new Random();
var persons = new ObservableCollection<Person>();
var names = new[] { "John", "Winston", "Adrianna", "Spencer", "Phoebe", "Lucas", "Carl", "Marissa", "Brandon", "Antoine", "Arielle", "Arielle", "Jamie", "Alexzander" };
var surnames = new[] { "Doe", "Tapia", "Cisneros", "Lynch", "Munoz", "Marsh", "Hudson", "Bartlett", "Gregory", "Banks", "Hood", "Fry", "Carroll" };
var companies = new[] { "Pineapple Inc.", "Macrosoft Redmond", "Amazing Basics Ltd", "Megabyte Computers Inc", "Roude Mics", "XD Projekt Red S.A.", "Lepo.co" };
var names = new[]
{
"John",
"Winston",
"Adrianna",
"Spencer",
"Phoebe",
"Lucas",
"Carl",
"Marissa",
"Brandon",
"Antoine",
"Arielle",
"Arielle",
"Jamie",
"Alexzander"
};
var surnames = new[]
{
"Doe",
"Tapia",
"Cisneros",
"Lynch",
"Munoz",
"Marsh",
"Hudson",
"Bartlett",
"Gregory",
"Banks",
"Hood",
"Fry",
"Carroll"
};
var companies = new[]
{
"Pineapple Inc.",
"Macrosoft Redmond",
"Amazing Basics Ltd",
"Megabyte Computers Inc",
"Roude Mics",
"XD Projekt Red S.A.",
"Lepo.co"
};
for (int i = 0; i < 50; i++)
persons.Add(new Person(
names[random.Next(0, names.Length)],
surnames[random.Next(0, surnames.Length)],
companies[random.Next(0, companies.Length)]));
persons.Add(
new Person(
names[random.Next(0, names.Length)],
surnames[random.Next(0, surnames.Length)],
companies[random.Next(0, companies.Length)]
)
);
return persons;
}
......
......@@ -7,7 +7,4 @@
namespace Wpf.Ui.Gallery.ViewModels.Pages.Collections;
public partial class TreeListViewModel : ObservableObject
{
}
public partial class TreeListViewModel : ObservableObject { }
......@@ -7,7 +7,4 @@
namespace Wpf.Ui.Gallery.ViewModels.Pages.Collections;
public partial class TreeViewViewModel : ObservableObject
{
}
public partial class TreeViewViewModel : ObservableObject { }
......@@ -7,6 +7,4 @@
namespace Wpf.Ui.Gallery.ViewModels.Pages.DateAndTime;
public partial class CalendarViewModel : ObservableObject
{
}
public partial class CalendarViewModel : ObservableObject { }
......@@ -3,32 +3,28 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System.Collections.Generic;
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using Wpf.Ui.Common;
using Wpf.Ui.Gallery.ControlsLookup;
using Wpf.Ui.Gallery.Models;
using Wpf.Ui.Gallery.Views.Pages.DateAndTime;
namespace Wpf.Ui.Gallery.ViewModels.Pages.DateAndTime;
public partial class DateAndTimeViewModel : ObservableObject
{
[ObservableProperty]
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>
{
new()
{
Name = "Calendar",
Icon = SymbolRegular.CalendarLtr24,
Description = "Presents a calendar to the user.",
Link = "Calendar"
},
new()
{
Name = "DatePicker",
Icon = SymbolRegular.CalendarSearch20,
Description = "Control that lets pick a date.",
Link = "DatePicker"
}
};
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>(
ControlPages
.FromNamespace(typeof(DateAndTimePage).Namespace!)
.Select(
x =>
new NavigationCard()
{
Name = x.Name,
Icon = x.Icon,
Description = x.Description,
PageType = x.PageType
}
)
);
}
......@@ -7,6 +7,4 @@
namespace Wpf.Ui.Gallery.ViewModels.Pages.DateAndTime;
public partial class DatePickerViewModel : ObservableObject
{
}
public partial class DatePickerViewModel : ObservableObject { }
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
namespace Wpf.Ui.Gallery.ViewModels.Pages.DesignGuidance;
public partial class ColorsViewModel : ObservableObject { }
// This Source Code Form is subject to the terms of the MIT License.
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System.Windows.Controls;
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Controls;
using Wpf.Ui.Gallery.Models;
namespace Wpf.Ui.Gallery.ViewModels.Pages.Icons;
namespace Wpf.Ui.Gallery.ViewModels.Pages.DesignGuidance;
public partial class IconsViewModel : ObservableObject, INavigationAware
{
private bool _isInitialized = false;
private int _selectedIconId = 0;
private string _autoSuggestBoxText = String.Empty;
......@@ -24,10 +22,13 @@ public partial class IconsViewModel : ObservableObject, INavigationAware
private string _selectedSymbolName = String.Empty;
[ObservableProperty]
private string _selectedSymbolCharacter = String.Empty;
private string _selectedSymbolUnicodePoint = String.Empty;
[ObservableProperty]
private string _selectedSymbolTextGlyph = String.Empty;
[ObservableProperty]
private string _codeBlock = String.Empty;
private string _selectedSymbolXaml = String.Empty;
[ObservableProperty]
private bool _isIconFilled = false;
......@@ -51,37 +52,9 @@ public string AutoSuggestBoxText
}
}
public void OnNavigatedTo()
public IconsViewModel()
{
if (!_isInitialized)
InitializeViewModel();
}
public void OnNavigatedFrom()
{ }
[RelayCommand]
public void OnIconSelected(int parameter)
{
_selectedIconId = parameter;
UpdateSymbolData();
}
[RelayCommand]
public void OnCheckboxChecked(object sender)
{
if (sender is not CheckBox checkbox)
return;
IsIconFilled = checkbox?.IsChecked ?? false;
UpdateSymbolData();
}
private void InitializeViewModel()
{
Task.Run(() =>
_ = Task.Run(() =>
{
var id = 0;
var names = Enum.GetNames(typeof(Common.SymbolRegular));
......@@ -93,14 +66,16 @@ private void InitializeViewModel()
{
var icon = Common.SymbolGlyph.Parse(iconName);
icons.Add(new DisplayableIcon
{
Id = id++,
Name = iconName,
Icon = icon,
Symbol = ((char)icon).ToString(),
Code = ((int)icon).ToString("X4")
});
icons.Add(
new DisplayableIcon
{
Id = id++,
Name = iconName,
Icon = icon,
Symbol = ((char)icon).ToString(),
Code = ((int)icon).ToString("X4")
}
);
}
IconsCollection = icons;
......@@ -110,13 +85,35 @@ private void InitializeViewModel()
if (icons.Count > 4)
{
_selectedIconId = 4;
UpdateSymbolData();
}
_isInitialized = true;
});
}
public void OnNavigatedTo() { }
public void OnNavigatedFrom() { }
[RelayCommand]
public void OnIconSelected(int parameter)
{
_selectedIconId = parameter;
UpdateSymbolData();
}
[RelayCommand]
public void OnCheckboxChecked(object sender)
{
if (sender is not CheckBox checkbox)
return;
IsIconFilled = checkbox?.IsChecked ?? false;
UpdateSymbolData();
}
private void UpdateSymbolData()
{
if (IconsCollection.Count - 1 < _selectedIconId)
......@@ -125,14 +122,16 @@ private void UpdateSymbolData()
var selectedSymbol = IconsCollection.FirstOrDefault(sym => sym.Id == _selectedIconId);
SelectedSymbol = selectedSymbol.Icon;
SelectedSymbolCharacter = "&#x" + selectedSymbol.Code;
SelectedSymbolName = selectedSymbol.Name;
CodeBlock = $"<ui:SymbolIcon Symbol=\"{selectedSymbol.Name}\"{(IsIconFilled ? " Filled=\"True\"" : "")}/>";
SelectedSymbolUnicodePoint = selectedSymbol.Code;
SelectedSymbolTextGlyph = $"&#x{selectedSymbol.Code};";
SelectedSymbolXaml =
$"<ui:SymbolIcon Symbol=\"{selectedSymbol.Name}\"{(IsIconFilled ? " Filled=\"True\"" : "")}/>";
}
private void UpdateSearchResults(string searchedText)
{
Task.Run(() =>
_ = Task.Run(() =>
{
if (String.IsNullOrEmpty(searchedText))
{
......@@ -144,7 +143,8 @@ private void UpdateSearchResults(string searchedText)
var formattedText = searchedText.ToLower().Trim();
FilteredIconsCollection = IconsCollection
.Where(icon => icon.Name.ToLower().Contains(formattedText)).ToArray();
.Where(icon => icon.Name.ToLower().Contains(formattedText))
.ToArray();
return true;
});
......
......@@ -3,10 +3,6 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using CommunityToolkit.Mvvm.ComponentModel;
namespace Wpf.Ui.Gallery.ViewModels.Pages.DesignGuidance;
namespace Wpf.Ui.Gallery.ViewModels.Pages.Icons;
public partial class FontIconViewModel : ObservableObject
{
}
public partial class TypographyViewModel : ObservableObject { }
......@@ -3,7 +3,7 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls.ContentDialogControl;
using Wpf.Ui.Controls;
using Wpf.Ui.Gallery.Controls;
namespace Wpf.Ui.Gallery.ViewModels.Pages.DialogsAndFlyouts;
......@@ -23,14 +23,16 @@ public ContentDialogViewModel(IContentDialogService contentDialogService)
[RelayCommand]
private async Task OnShowDialog(object content)
{
var result = await _contentDialogService.ShowSimpleDialogAsync(new SimpleContentDialogCreateOptions()
{
Title = "Save your work?",
Content = content,
PrimaryButtonText = "Save",
SecondaryButtonText = "Don't Save",
CloseButtonText = "Cancel",
});
var result = await _contentDialogService.ShowSimpleDialogAsync(
new SimpleContentDialogCreateOptions()
{
Title = "Save your work?",
Content = content,
PrimaryButtonText = "Save",
SecondaryButtonText = "Don't Save",
CloseButtonText = "Cancel",
}
);
DialogResultText = result switch
{
......@@ -43,7 +45,9 @@ private async Task OnShowDialog(object content)
[RelayCommand]
private async Task OnShowSignInContentDialog()
{
var termsOfUseContentDialog = new TermsOfUseContentDialog(_contentDialogService.GetContentPresenter());
var termsOfUseContentDialog = new TermsOfUseContentDialog(
_contentDialogService.GetContentPresenter()
);
await termsOfUseContentDialog.ShowAsync();
}
}
......@@ -3,46 +3,28 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System.Collections.Generic;
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using Wpf.Ui.Common;
using Wpf.Ui.Gallery.ControlsLookup;
using Wpf.Ui.Gallery.Models;
using Wpf.Ui.Gallery.Views.Pages.DialogsAndFlyouts;
namespace Wpf.Ui.Gallery.ViewModels.Pages.DialogsAndFlyouts;
public partial class DialogsAndFlyoutsViewModel : ObservableObject
{
[ObservableProperty]
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>
{
new()
{
Name = "Snackbar",
Icon = SymbolRegular.PlayingCards20,
Description = "Information card at the bottom.",
Link = "Snackbar"
},
new()
{
Name = "Dialog",
Icon = SymbolRegular.CalendarMultiple24,
Description = "Card covering the app content",
Link = "Dialog"
},
new()
{
Name = "Flyout",
Icon = SymbolRegular.AppTitle24,
Description = "Contextual popup.",
Link = "Flyout"
},
new()
{
Name = "MessageBox",
Icon = SymbolRegular.CalendarInfo20,
Description = "MessageBox",
Link = "MessageBox"
}
};
private ICollection<NavigationCard> _navigationCards = new ObservableCollection<NavigationCard>(
ControlPages
.FromNamespace(typeof(DialogsAndFlyoutsPage).Namespace!)
.Select(
x =>
new NavigationCard()
{
Name = x.Name,
Icon = x.Icon,
Description = x.Description,
PageType = x.PageType
}
)
);
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。