├── .gitignore
├── .gitlab-ci.yml
├── .gitpod.yml
├── LICENSE
├── README.md
├── _config.yml
└── src
├── JamSoft.AvaloniaUI.Dialogs.Sample
├── .gitignore
├── App.axaml
├── App.axaml.cs
├── Assets
│ └── avalonia-logo.ico
├── BootStrapper.cs
├── JamSoft.AvaloniaUI.Dialogs.Sample.csproj
├── Models
│ └── MyUserSettings.cs
├── Program.cs
├── Roots.xml
├── ViewModels
│ ├── ComboBoxItemViewModel.cs
│ ├── CustomBaseChildWindowViewModel.cs
│ ├── MainWindowViewModel.cs
│ ├── MyChildWindowViewModel.cs
│ ├── MyDialogViewModel.cs
│ ├── MyWizardViewModel.cs
│ ├── SirNotAppearingInThisAppViewModel.cs
│ └── ViewModelBase.cs
├── Views
│ ├── CustomBaseChildWindowView.axaml
│ ├── CustomBaseChildWindowView.axaml.cs
│ ├── MainWindow.axaml
│ ├── MainWindow.axaml.cs
│ ├── MyChildWindowView.axaml
│ ├── MyChildWindowView.axaml.cs
│ ├── MyDialogView.axaml
│ ├── MyDialogView.axaml.cs
│ ├── MyWizardView.axaml
│ └── MyWizardView.axaml.cs
└── app.manifest
├── JamSoft.AvaloniaUI.Dialogs.sln
├── JamSoft.AvaloniaUI.Dialogs
├── Assets
│ ├── CloseIcon
│ │ ├── Android
│ │ │ ├── icons8-close-120(-xxxhdpi).png
│ │ │ ├── icons8-close-23(-ldpi).png
│ │ │ ├── icons8-close-30(-mdpi).png
│ │ │ ├── icons8-close-45(-hdpi).png
│ │ │ ├── icons8-close-60(-xhdpi).png
│ │ │ └── icons8-close-90(-xxhdpi).png
│ │ ├── iOS
│ │ │ ├── icons8-close-30(@1x).png
│ │ │ ├── icons8-close-60(@2x).png
│ │ │ └── icons8-close-90(@3x).png
│ │ ├── icons8-close-120.png
│ │ ├── icons8-close-240.png
│ │ ├── icons8-close-30.png
│ │ ├── icons8-close-480.png
│ │ ├── icons8-close-60.png
│ │ └── icons8-close-90.png
│ ├── add.png
│ ├── back-up.png
│ ├── ban.png
│ ├── battery-half.png
│ ├── check-circle.png
│ ├── cross-circle.png
│ ├── customize.png
│ ├── database.png
│ ├── diamond-exclamation.png
│ ├── exclamation.png
│ ├── folder-open.png
│ ├── info.png
│ ├── interrogation.png
│ └── wifi.png
├── Commands
│ └── DelegateCommand.cs
├── Controls
│ ├── Wizard.cs
│ └── WizardStep.cs
├── DialogService.cs
├── DialogServiceConfiguration.cs
├── DialogServiceFactory.cs
├── Events
│ ├── EventHandlerUtils.cs
│ ├── IWeakEventHandler.cs
│ ├── RequestCloseDialogEventArgs.cs
│ ├── UnregisterCallback.cs
│ └── WeakEventHandler.cs
├── Helpers
│ ├── CommonFilters.cs
│ └── CommonFiltersExtensionMethods.cs
├── IDialogService.cs
├── IMessageBoxService.cs
├── JamSoft.AvaloniaUI.Dialogs.csproj
├── JamSoftLogo-Splat513x513.png
├── MessageBoxService.cs
├── MsgBox
│ ├── IconResolver.cs
│ ├── MsgBoxButton.cs
│ ├── MsgBoxButtonResult.cs
│ ├── MsgBoxImage.cs
│ └── MsgBoxResult.cs
├── Themes
│ ├── ChildStyle.axaml
│ ├── Default.axaml
│ ├── ModalStyle.axaml
│ ├── MsgBoxStyles.axaml
│ ├── WizardStepStyle.axaml
│ └── WizardStyle.axaml
├── ViewModels
│ ├── ChildWindowViewModel.cs
│ ├── DialogViewModel.cs
│ ├── IChildWindowViewModel.cs
│ ├── IDialogResultVmHelper.cs
│ ├── IDialogViewModel.cs
│ ├── IMsgBoxViewModel.cs
│ ├── IWindowPositionAware.cs
│ ├── IWizardViewModel.cs
│ ├── MsgBoxViewModel.cs
│ └── WizardViewModel.cs
└── Views
│ ├── ChildWindow.axaml
│ ├── ChildWindow.axaml.cs
│ ├── DialogWindow.axaml
│ ├── DialogWindow.axaml.cs
│ ├── MsgBoxView.axaml
│ ├── MsgBoxView.axaml.cs
│ ├── MsgBoxWindow.axaml
│ └── MsgBoxWindow.axaml.cs
└── img
├── JamSoftLogo-Splat513x513.png
├── basic-dialog.png
├── child-window.png
├── message-box-checkbox.png
├── message-box.png
├── sample-app.png
└── wizard.png
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | *.*~
3 | project.lock.json
4 | .DS_Store
5 | *.pyc
6 | nupkg/
7 |
8 | # Visual Studio Code
9 | .vscode
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.userosscache
15 | *.sln.docstates
16 | *.snk
17 |
18 | # Build results
19 | [Dd]ebug/
20 | [Dd]ebugPublic/
21 | [Rr]elease/
22 | [Rr]eleases/
23 | x64/
24 | x86/
25 | build/
26 | bld/
27 | [Bb]in/
28 | [Oo]bj/
29 | [Oo]ut/
30 | msbuild.log
31 | msbuild.err
32 | msbuild.wrn
33 |
34 | src/.idea/
35 | .vs
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | image: mcr.microsoft.com/dotnet/core/sdk:latest
2 |
3 | stages:
4 | - build
5 |
6 | build:
7 | stage: build
8 | script:
9 | - "dotnet build src\\JamSoft.AvaloniaUI.Dialogs.sln"
10 | artifacts:
11 | paths:
12 | - bin/
--------------------------------------------------------------------------------
/.gitpod.yml:
--------------------------------------------------------------------------------
1 | image: gitpod/workspace-dotnet
2 |
3 | tasks:
4 | - init: dotnet build
5 | command: dotnet run
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 James Green
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # Tye
66 | .tye/
67 |
68 | # ASP.NET Scaffolding
69 | ScaffoldingReadMe.txt
70 |
71 | # StyleCop
72 | StyleCopReport.xml
73 |
74 | # Files built by Visual Studio
75 | *_i.c
76 | *_p.c
77 | *_h.h
78 | *.ilk
79 | *.meta
80 | *.obj
81 | *.iobj
82 | *.pch
83 | *.pdb
84 | *.ipdb
85 | *.pgc
86 | *.pgd
87 | *.rsp
88 | *.sbr
89 | *.tlb
90 | *.tli
91 | *.tlh
92 | *.tmp
93 | *.tmp_proj
94 | *_wpftmp.csproj
95 | *.log
96 | *.vspscc
97 | *.vssscc
98 | .builds
99 | *.pidb
100 | *.svclog
101 | *.scc
102 |
103 | # Chutzpah Test files
104 | _Chutzpah*
105 |
106 | # Visual C++ cache files
107 | ipch/
108 | *.aps
109 | *.ncb
110 | *.opendb
111 | *.opensdf
112 | *.sdf
113 | *.cachefile
114 | *.VC.db
115 | *.VC.VC.opendb
116 |
117 | # Visual Studio profiler
118 | *.psess
119 | *.vsp
120 | *.vspx
121 | *.sap
122 |
123 | # Visual Studio Trace Files
124 | *.e2e
125 |
126 | # TFS 2012 Local Workspace
127 | $tf/
128 |
129 | # Guidance Automation Toolkit
130 | *.gpState
131 |
132 | # ReSharper is a .NET coding add-in
133 | _ReSharper*/
134 | *.[Rr]e[Ss]harper
135 | *.DotSettings.user
136 |
137 | # TeamCity is a build add-in
138 | _TeamCity*
139 |
140 | # DotCover is a Code Coverage Tool
141 | *.dotCover
142 |
143 | # AxoCover is a Code Coverage Tool
144 | .axoCover/*
145 | !.axoCover/settings.json
146 |
147 | # Coverlet is a free, cross platform Code Coverage Tool
148 | coverage*.json
149 | coverage*.xml
150 | coverage*.info
151 |
152 | # Visual Studio code coverage results
153 | *.coverage
154 | *.coveragexml
155 |
156 | # NCrunch
157 | _NCrunch_*
158 | .*crunch*.local.xml
159 | nCrunchTemp_*
160 |
161 | # MightyMoose
162 | *.mm.*
163 | AutoTest.Net/
164 |
165 | # Web workbench (sass)
166 | .sass-cache/
167 |
168 | # Installshield output folder
169 | [Ee]xpress/
170 |
171 | # DocProject is a documentation generator add-in
172 | DocProject/buildhelp/
173 | DocProject/Help/*.HxT
174 | DocProject/Help/*.HxC
175 | DocProject/Help/*.hhc
176 | DocProject/Help/*.hhk
177 | DocProject/Help/*.hhp
178 | DocProject/Help/Html2
179 | DocProject/Help/html
180 |
181 | # Click-Once directory
182 | publish/
183 |
184 | # Publish Web Output
185 | *.[Pp]ublish.xml
186 | *.azurePubxml
187 | # Note: Comment the next line if you want to checkin your web deploy settings,
188 | # but database connection strings (with potential passwords) will be unencrypted
189 | *.pubxml
190 | *.publishproj
191 |
192 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
193 | # checkin your Azure Web App publish settings, but sensitive information contained
194 | # in these scripts will be unencrypted
195 | PublishScripts/
196 |
197 | # NuGet Packages
198 | *.nupkg
199 | # NuGet Symbol Packages
200 | *.snupkg
201 | # The packages folder can be ignored because of Package Restore
202 | **/[Pp]ackages/*
203 | # except build/, which is used as an MSBuild target.
204 | !**/[Pp]ackages/build/
205 | # Uncomment if necessary however generally it will be regenerated when needed
206 | #!**/[Pp]ackages/repositories.config
207 | # NuGet v3's project.json files produces more ignorable files
208 | *.nuget.props
209 | *.nuget.targets
210 |
211 | # Microsoft Azure Build Output
212 | csx/
213 | *.build.csdef
214 |
215 | # Microsoft Azure Emulator
216 | ecf/
217 | rcf/
218 |
219 | # Windows Store app package directories and files
220 | AppPackages/
221 | BundleArtifacts/
222 | Package.StoreAssociation.xml
223 | _pkginfo.txt
224 | *.appx
225 | *.appxbundle
226 | *.appxupload
227 |
228 | # Visual Studio cache files
229 | # files ending in .cache can be ignored
230 | *.[Cc]ache
231 | # but keep track of directories ending in .cache
232 | !?*.[Cc]ache/
233 |
234 | # Others
235 | ClientBin/
236 | ~$*
237 | *~
238 | *.dbmdl
239 | *.dbproj.schemaview
240 | *.jfm
241 | *.pfx
242 | *.publishsettings
243 | orleans.codegen.cs
244 |
245 | # Including strong name files can present a security risk
246 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
247 | #*.snk
248 |
249 | # Since there are multiple workflows, uncomment next line to ignore bower_components
250 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
251 | #bower_components/
252 |
253 | # RIA/Silverlight projects
254 | Generated_Code/
255 |
256 | # Backup & report files from converting an old project file
257 | # to a newer Visual Studio version. Backup files are not needed,
258 | # because we have git ;-)
259 | _UpgradeReport_Files/
260 | Backup*/
261 | UpgradeLog*.XML
262 | UpgradeLog*.htm
263 | ServiceFabricBackup/
264 | *.rptproj.bak
265 |
266 | # SQL Server files
267 | *.mdf
268 | *.ldf
269 | *.ndf
270 |
271 | # Business Intelligence projects
272 | *.rdl.data
273 | *.bim.layout
274 | *.bim_*.settings
275 | *.rptproj.rsuser
276 | *- [Bb]ackup.rdl
277 | *- [Bb]ackup ([0-9]).rdl
278 | *- [Bb]ackup ([0-9][0-9]).rdl
279 |
280 | # Microsoft Fakes
281 | FakesAssemblies/
282 |
283 | # GhostDoc plugin setting file
284 | *.GhostDoc.xml
285 |
286 | # Node.js Tools for Visual Studio
287 | .ntvs_analysis.dat
288 | node_modules/
289 |
290 | # Visual Studio 6 build log
291 | *.plg
292 |
293 | # Visual Studio 6 workspace options file
294 | *.opt
295 |
296 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
297 | *.vbw
298 |
299 | # Visual Studio LightSwitch build output
300 | **/*.HTMLClient/GeneratedArtifacts
301 | **/*.DesktopClient/GeneratedArtifacts
302 | **/*.DesktopClient/ModelManifest.xml
303 | **/*.Server/GeneratedArtifacts
304 | **/*.Server/ModelManifest.xml
305 | _Pvt_Extensions
306 |
307 | # Paket dependency manager
308 | .paket/paket.exe
309 | paket-files/
310 |
311 | # FAKE - F# Make
312 | .fake/
313 |
314 | # CodeRush personal settings
315 | .cr/personal
316 |
317 | # Python Tools for Visual Studio (PTVS)
318 | __pycache__/
319 | *.pyc
320 |
321 | # Cake - Uncomment if you are using it
322 | # tools/**
323 | # !tools/packages.config
324 |
325 | # Tabs Studio
326 | *.tss
327 |
328 | # Telerik's JustMock configuration file
329 | *.jmconfig
330 |
331 | # BizTalk build output
332 | *.btp.cs
333 | *.btm.cs
334 | *.odx.cs
335 | *.xsd.cs
336 |
337 | # OpenCover UI analysis results
338 | OpenCover/
339 |
340 | # Azure Stream Analytics local run output
341 | ASALocalRun/
342 |
343 | # MSBuild Binary and Structured Log
344 | *.binlog
345 |
346 | # NVidia Nsight GPU debugger configuration file
347 | *.nvuser
348 |
349 | # MFractors (Xamarin productivity tool) working folder
350 | .mfractor/
351 |
352 | # Local History for Visual Studio
353 | .localhistory/
354 |
355 | # BeatPulse healthcheck temp database
356 | healthchecksdb
357 |
358 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
359 | MigrationBackup/
360 |
361 | # Ionide (cross platform F# VS Code tools) working folder
362 | .ionide/
363 |
364 | # Fody - auto-generated XML schema
365 | FodyWeavers.xsd
366 |
367 | ##
368 | ## Visual studio for Mac
369 | ##
370 |
371 |
372 | # globs
373 | Makefile.in
374 | *.userprefs
375 | *.usertasks
376 | config.make
377 | config.status
378 | aclocal.m4
379 | install-sh
380 | autom4te.cache/
381 | *.tar.gz
382 | tarballs/
383 | test-results/
384 |
385 | # Mac bundle stuff
386 | *.dmg
387 | *.app
388 |
389 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
390 | # General
391 | .DS_Store
392 | .AppleDouble
393 | .LSOverride
394 |
395 | # Icon must end with two \r
396 | Icon
397 |
398 |
399 | # Thumbnails
400 | ._*
401 |
402 | # Files that might appear in the root of a volume
403 | .DocumentRevisions-V100
404 | .fseventsd
405 | .Spotlight-V100
406 | .TemporaryItems
407 | .Trashes
408 | .VolumeIcon.icns
409 | .com.apple.timemachine.donotpresent
410 |
411 | # Directories potentially created on remote AFP share
412 | .AppleDB
413 | .AppleDesktop
414 | Network Trash Folder
415 | Temporary Items
416 | .apdisk
417 |
418 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
419 | # Windows thumbnail cache files
420 | Thumbs.db
421 | ehthumbs.db
422 | ehthumbs_vista.db
423 |
424 | # Dump file
425 | *.stackdump
426 |
427 | # Folder config file
428 | [Dd]esktop.ini
429 |
430 | # Recycle Bin used on file shares
431 | $RECYCLE.BIN/
432 |
433 | # Windows Installer files
434 | *.cab
435 | *.msi
436 | *.msix
437 | *.msm
438 | *.msp
439 |
440 | # Windows shortcuts
441 | *.lnk
442 |
443 | # JetBrains Rider
444 | .idea/
445 | *.sln.iml
446 |
447 | ##
448 | ## Visual Studio Code
449 | ##
450 | .vscode/*
451 | !.vscode/settings.json
452 | !.vscode/tasks.json
453 | !.vscode/launch.json
454 | !.vscode/extensions.json
455 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Markup.Xaml;
4 | using JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
5 | using JamSoft.AvaloniaUI.Dialogs.Sample.Views;
6 | using Splat;
7 |
8 | namespace JamSoft.AvaloniaUI.Dialogs.Sample;
9 |
10 | public partial class App : Application
11 | {
12 | public override void Initialize()
13 | {
14 | AvaloniaXamlLoader.Load(this);
15 | }
16 |
17 | public override void OnFrameworkInitializationCompleted()
18 | {
19 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
20 | {
21 | desktop.MainWindow = new MainWindow
22 | {
23 | DataContext = Locator.Current.GetService()
24 | };
25 | }
26 |
27 | base.OnFrameworkInitializationCompleted();
28 | }
29 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Assets/avalonia-logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs.Sample/Assets/avalonia-logo.ico
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/BootStrapper.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
3 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
4 | using Splat;
5 |
6 | namespace JamSoft.AvaloniaUI.Dialogs.Sample;
7 |
8 | public static class BootStrapper
9 | {
10 | public static void Register(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
11 | {
12 | services.RegisterLazySingleton(() => DialogServiceFactory.Create(new DialogServiceConfiguration
13 | {
14 | ApplicationName = "Dialog Sample App",
15 | UseApplicationNameInTitle = true,
16 | ViewsAssemblyName = Assembly.GetExecutingAssembly().GetName().Name
17 | }));
18 |
19 | services.RegisterLazySingleton(DialogServiceFactory.CreateMessageBoxService);
20 |
21 | services.Register(() => new MainWindowViewModel(resolver.GetService()!, resolver.GetService()!));
22 | services.Register(() => new MyDialogViewModel());
23 | services.Register(() => new MyChildWindowViewModel());
24 | services.Register(() => new CustomBaseChildWindowViewModel());
25 | services.Register(() => new SirNotAppearingInThisAppViewModel()); // this has no matching view on purpose
26 | services.Register(() => new MyWizardViewModel());
27 | }
28 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/JamSoft.AvaloniaUI.Dialogs.Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0
5 | enable
6 | true
7 | app.manifest
8 | 12
9 | Assets\avalonia-logo.ico
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | MyWizardView.axaml
41 | Code
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Models/MyUserSettings.cs:
--------------------------------------------------------------------------------
1 | using JamSoft.Helpers.Configuration;
2 |
3 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.Models;
4 |
5 | public class MyUserSettings : SettingsBase
6 | {
7 | public double Left { get; set; }
8 | public double Top { get; set; }
9 | public double Height { get; set; }
10 | public double Width { get; set; }
11 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Program.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.ReactiveUI;
3 | using System;
4 | using JamSoft.AvaloniaUI.Dialogs.Sample.Models;
5 | using Splat;
6 |
7 | namespace JamSoft.AvaloniaUI.Dialogs.Sample;
8 |
9 | class Program
10 | {
11 | // Initialization code. Don't use any Avalonia, third-party APIs or any
12 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
13 | // yet and stuff might break.
14 | [STAThread]
15 | public static void Main(string[] args)
16 | {
17 | RegisterDependencies();
18 |
19 | MyUserSettings.Load(AppDomain.CurrentDomain.BaseDirectory);
20 |
21 | BuildAvaloniaApp()
22 | .StartWithClassicDesktopLifetime(args);
23 | }
24 |
25 | private static void RegisterDependencies() =>
26 | BootStrapper.Register(Locator.CurrentMutable, Locator.Current);
27 |
28 | // Avalonia configuration, don't remove; also used by visual designer.
29 | public static AppBuilder BuildAvaloniaApp()
30 | => AppBuilder.Configure()
31 | .UsePlatformDetect()
32 | .LogToTrace()
33 | .UseReactiveUI();
34 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Roots.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/ComboBoxItemViewModel.cs:
--------------------------------------------------------------------------------
1 | using JamSoft.Helpers.AvaloniaUI.Patterns.Mvvm;
2 | using ReactiveUI;
3 |
4 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
5 |
6 | public class ComboBoxItemViewModel : AvaloniaViewModelBase
7 | {
8 | private string? _name;
9 | private object? _value;
10 |
11 | public string? Name
12 | {
13 | get => _name;
14 | set => this.RaiseAndSetIfChanged(ref _name, value);
15 | }
16 |
17 | public object? Value
18 | {
19 | get => _value;
20 | set => this.RaiseAndSetIfChanged(ref _value, value);
21 | }
22 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/CustomBaseChildWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Windows.Input;
4 | using Avalonia.Controls;
5 | using Avalonia.Media;
6 | using Avalonia.Media.Imaging;
7 | using Avalonia.Platform;
8 | using JamSoft.AvaloniaUI.Dialogs.Commands;
9 | using JamSoft.AvaloniaUI.Dialogs.Events;
10 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
11 |
12 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
13 |
14 | public class CustomBaseChildWindowViewModel : IChildWindowViewModel
15 | {
16 | private ICommand _cancelCommand;
17 |
18 | public CustomBaseChildWindowViewModel()
19 | {
20 | AcceptCommand = new DelegateCommand(null);
21 | CancelCommand = new DelegateCommand(null);
22 | CloseIcon = new Bitmap(AssetLoader.Open(new Uri("avares://JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-30.png")));
23 |
24 | _cancelCommand = new DelegateCommand(() => InvokeRequestCloseDialog(new RequestCloseDialogEventArgs(false)), CanCancel);
25 | CancelCommandText = "Cancel";
26 | }
27 |
28 | private void InvokeRequestCloseDialog(RequestCloseDialogEventArgs e)
29 | {
30 | RequestCloseDialog?.Invoke(this, e);
31 | }
32 |
33 | public WindowStartupLocation Location { get; set; }
34 | public double RequestedTop { get; set; }
35 | public double RequestedLeft { get; set; }
36 | public string? ChildWindowTitle { get; set; }
37 | public double RequestedWidth { get; set; }
38 | public double RequestedHeight { get; set; }
39 | public IImage CloseIcon { get; set; }
40 |
41 | public event EventHandler? RequestCloseDialog = delegate { };
42 | public ICommand AcceptCommand { get; set; }
43 |
44 | public ICommand CancelCommand
45 | {
46 | get => _cancelCommand;
47 | set => _cancelCommand = value;
48 | }
49 |
50 | public event PropertyChangedEventHandler? PropertyChanged = delegate { };
51 |
52 | public string? AcceptCommandText { get; set; }
53 | public string? CancelCommandText { get; set; }
54 | public bool CanAccept()
55 | {
56 | return true;
57 | }
58 |
59 | public bool CanCancel()
60 | {
61 | return true;
62 | }
63 |
64 | public bool HideCancelButton { get; set; }
65 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Input;
4 | using Avalonia.Controls;
5 | using Avalonia.Platform.Storage;
6 | using JamSoft.AvaloniaUI.Dialogs.Commands;
7 | using JamSoft.AvaloniaUI.Dialogs.Helpers;
8 | using JamSoft.AvaloniaUI.Dialogs.MsgBox;
9 | using JamSoft.AvaloniaUI.Dialogs.Sample.Models;
10 | using JamSoft.AvaloniaUI.Dialogs.Sample.Views;
11 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
12 | using ReactiveUI;
13 | using Splat;
14 |
15 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
16 |
17 | public class MainWindowViewModel : ViewModelBase
18 | {
19 | private readonly IDialogService _dialogService;
20 | private readonly IMessageBoxService _messageBoxService;
21 | private ICommand? _openFileCommand;
22 | private ICommand? _openFolderCommand;
23 | private ICommand? _openWordFileCommand;
24 | private ICommand? _saveFileCommand;
25 | private ICommand? _saveFileWithNameCommand;
26 | private ICommand? _saveWordFileCommand;
27 | private ICommand? _openFilesCommand;
28 | private ICommand? _showDialogCommand;
29 | private ICommand? _showCustomizedDialogCommand;
30 | private ICommand? _showChildWindowCommand;
31 | private ICommand? _showDialogAutoFindViewCommand;
32 | private ICommand? _showChildWindowAutoFindViewCommand;
33 | private ICommand? _showCustomChildWindowCommand;
34 | private ICommand? _childWindowRememberPositionCommand;
35 | private ICommand? _missingViewCommand;
36 | private ICommand? _wizardViewCommand;
37 | private ICommand? _showMessageBoxCommand;
38 | private string? _message;
39 |
40 | public MainWindowViewModel(IDialogService dialogService, IMessageBoxService messageBoxService)
41 | {
42 | _dialogService = dialogService;
43 | _messageBoxService = messageBoxService;
44 |
45 | Message = "Welcome to JamSoft Avalonia Dialogs!";
46 |
47 | OpenFileCommand = new DelegateCommand(OpenFileCommandExecuted, () => true);
48 | OpenFolderCommand = new DelegateCommand(OpenFolderCommandExecuted, () => true);
49 | OpenWordFileCommand = new DelegateCommand(OpenWordFileCommandExecuted, () => true);
50 | OpenFilesCommand = new DelegateCommand(OpenFilesCommandExecuted, () => true);
51 | SaveFileCommand = new DelegateCommand(SaveFileCommandExecuted, () => true);
52 | SaveFileWithNameCommand = new DelegateCommand(SaveFileWithNameCommandExecuted, () => true);
53 | SaveWordFileCommand = new DelegateCommand(SaveWordFileCommandExecuted, () => true);
54 | ShowDialogCommand = new DelegateCommand(ShowDialogCommandExecuted, () => true);
55 | ShowDialogAutoFindViewCommand = new DelegateCommand(ShowDialogAutoFindViewCommandExecuted, () => true);
56 | ShowCustomizedDialogCommand = new DelegateCommand(ShowCustomizedDialogCommandExecuted, () => true);
57 | ShowChildWindowCommand = new DelegateCommand(ShowChildWindowCommandExecuted, () => true);
58 | ShowChildWindowAutoFindViewCommand = new DelegateCommand(ShowChildWindowAutoFindViewCommandExecuted, () => true);
59 | ShowCustomChildWindowCommand = new DelegateCommand(ShowCustomChildWindowAutoFindViewCommandExecuted, () => true);
60 | ChildWindowRememberPositionCommand = new DelegateCommand(ChildWindowRememberPositionCommandExecuted, () => true);
61 | MissingViewCommand = new DelegateCommand(MissingViewCommandExecuted, () => true);
62 | WizardViewCommand = new DelegateCommand(WizardViewCommandExecuted, () => true);
63 | ShowMessageBoxCommand = new DelegateCommand(ShowMessageBoxCommandExecuted, () => true);
64 | }
65 |
66 | public ICommand? ShowMessageBoxCommand
67 | {
68 | get => _showMessageBoxCommand;
69 | set => this.RaiseAndSetIfChanged(ref _showMessageBoxCommand, value);
70 | }
71 |
72 | public ICommand? OpenFolderCommand
73 | {
74 | get => _openFolderCommand;
75 | set => this.RaiseAndSetIfChanged(ref _openFolderCommand, value);
76 | }
77 |
78 | public ICommand? WizardViewCommand
79 | {
80 | get => _wizardViewCommand;
81 | set => this.RaiseAndSetIfChanged(ref _wizardViewCommand, value);
82 | }
83 |
84 | public ICommand? MissingViewCommand
85 | {
86 | get => _missingViewCommand;
87 | set => this.RaiseAndSetIfChanged(ref _missingViewCommand, value);
88 | }
89 |
90 | public ICommand? ChildWindowRememberPositionCommand
91 | {
92 | get => _childWindowRememberPositionCommand;
93 | set => this.RaiseAndSetIfChanged(ref _childWindowRememberPositionCommand, value);
94 | }
95 |
96 | public ICommand? ShowCustomChildWindowCommand
97 | {
98 | get => _showCustomChildWindowCommand;
99 | set => this.RaiseAndSetIfChanged(ref _showCustomChildWindowCommand, value);
100 | }
101 |
102 | public ICommand? ShowChildWindowAutoFindViewCommand
103 | {
104 | get => _showChildWindowAutoFindViewCommand;
105 | set => this.RaiseAndSetIfChanged(ref _showChildWindowAutoFindViewCommand, value);
106 | }
107 |
108 | public ICommand? ShowDialogAutoFindViewCommand
109 | {
110 | get => _showDialogAutoFindViewCommand;
111 | set => this.RaiseAndSetIfChanged(ref _showDialogAutoFindViewCommand, value);
112 | }
113 |
114 | public ICommand? ShowChildWindowCommand
115 | {
116 | get => _showChildWindowCommand;
117 | set => this.RaiseAndSetIfChanged(ref _showChildWindowCommand, value);
118 | }
119 |
120 | public ICommand? ShowDialogCommand
121 | {
122 | get => _showDialogCommand;
123 | set => this.RaiseAndSetIfChanged(ref _showDialogCommand, value);
124 | }
125 |
126 | public ICommand? ShowCustomizedDialogCommand
127 | {
128 | get => _showCustomizedDialogCommand;
129 | set => this.RaiseAndSetIfChanged(ref _showCustomizedDialogCommand, value);
130 | }
131 |
132 | public ICommand? OpenFilesCommand
133 | {
134 | get => _openFilesCommand;
135 | set => this.RaiseAndSetIfChanged(ref _openFilesCommand, value);
136 | }
137 |
138 | public ICommand? SaveFileCommand
139 | {
140 | get => _saveFileCommand;
141 | set => this.RaiseAndSetIfChanged(ref _saveFileCommand, value);
142 | }
143 |
144 | public ICommand? SaveFileWithNameCommand
145 | {
146 | get => _saveFileWithNameCommand;
147 | set => this.RaiseAndSetIfChanged(ref _saveFileWithNameCommand, value);
148 | }
149 |
150 | public ICommand? SaveWordFileCommand
151 | {
152 | get => _saveWordFileCommand;
153 | set => this.RaiseAndSetIfChanged(ref _saveWordFileCommand, value);
154 | }
155 |
156 | public ICommand? OpenFileCommand
157 | {
158 | get => _openFileCommand;
159 | set => this.RaiseAndSetIfChanged(ref _openFileCommand, value);
160 | }
161 |
162 | public ICommand? OpenWordFileCommand
163 | {
164 | get => _openWordFileCommand;
165 | set => this.RaiseAndSetIfChanged(ref _openWordFileCommand, value);
166 | }
167 |
168 | public string? Message
169 | {
170 | get => _message;
171 | set => this.RaiseAndSetIfChanged(ref _message, value);
172 | }
173 |
174 | private async void OpenFileCommandExecuted()
175 | {
176 | Message = await _dialogService.OpenFile("Open Any File");
177 | }
178 |
179 | private async void OpenFolderCommandExecuted()
180 | {
181 | Message = await _dialogService.OpenFolder("Open Any Folder");
182 | }
183 |
184 | private async void OpenWordFileCommandExecuted()
185 | {
186 | Message = await _dialogService.OpenFile("Open Word File", new List
187 | {
188 | CommonFilters.WordFilter
189 | });
190 | }
191 |
192 | private async void OpenFilesCommandExecuted()
193 | {
194 | Message = string.Join(Environment.NewLine, await _dialogService.OpenFiles("Open Multiple Files") ?? []);
195 | }
196 |
197 | private async void SaveFileCommandExecuted()
198 | {
199 | Message = await _dialogService.SaveFile("Save Any File");
200 | }
201 |
202 | private async void SaveFileWithNameCommandExecuted()
203 | {
204 | Message = await _dialogService.SaveFile("Save Any File", suggestedFileName:"Suggested Name");
205 | }
206 |
207 | private async void SaveWordFileCommandExecuted()
208 | {
209 | Message = await _dialogService.SaveFile("Save Word File", new List
210 | {
211 | CommonFilters.WordFilter
212 | });
213 | }
214 |
215 | private void ShowDialogCommandExecuted()
216 | {
217 | var vm = Locator.Current.GetService();
218 | if (vm != null) _dialogService.ShowDialog(new MyDialogView(), vm, DialogCallback);
219 | }
220 |
221 | private void ShowDialogAutoFindViewCommandExecuted()
222 | {
223 | var vm = Locator.Current.GetService();
224 | if (vm != null) _dialogService.ShowDialog(vm, DialogCallback);
225 | }
226 |
227 | private void ShowCustomizedDialogCommandExecuted()
228 | {
229 | var vm = Locator.Current.GetService();
230 | if (vm != null)
231 | {
232 | vm.AcceptCommandText = "Accept";
233 | vm.CancelCommandText = "Oh No!";
234 |
235 | _dialogService.ShowDialog(new MyDialogView(), vm, DialogCallback);
236 | }
237 | }
238 |
239 | private void DialogCallback(MyDialogViewModel? obj)
240 | {
241 | Message = obj?.DialogMessage;
242 | }
243 |
244 | private void ShowChildWindowCommandExecuted()
245 | {
246 | var vm = Locator.Current.GetService();
247 | if (vm != null)
248 | {
249 | vm.RequestedLeft = 50;
250 | vm.RequestedTop = 50;
251 | vm.RequestedHeight = 500;
252 | vm.RequestedWidth = 600;
253 | // these values can be stored in user settings and loaded at runtime etc.
254 | vm.ChildMessage = "Child Message Value";
255 | vm.ChildWindowTitle = "My Child Window Title";
256 |
257 | _dialogService.ShowChildWindow(new MyChildWindowView(), vm,
258 | model => { Message = $"Child Closed - {model.ChildMessage}"; });
259 | }
260 | }
261 |
262 | private void ShowChildWindowAutoFindViewCommandExecuted()
263 | {
264 | var vm = Locator.Current.GetService();
265 | if (vm != null)
266 | {
267 | vm.RequestedLeft = 50;
268 | vm.RequestedTop = 50;
269 | vm.RequestedHeight = 500;
270 | vm.RequestedWidth = 600;
271 | vm.ChildMessage = "Child Message Value";
272 | vm.ChildWindowTitle = "My Child Window Title Auto Find";
273 | vm.Location = WindowStartupLocation.CenterScreen;
274 |
275 | _dialogService.ShowChildWindow(vm, model => { Message = $"Child Closed - {model.ChildMessage}"; });
276 | }
277 | }
278 |
279 | private void ShowCustomChildWindowAutoFindViewCommandExecuted()
280 | {
281 | var vm = Locator.Current.GetService();
282 | if (vm != null)
283 | {
284 | vm.RequestedLeft = 50;
285 | vm.RequestedTop = 50;
286 | vm.RequestedHeight = 500;
287 | vm.RequestedWidth = 600;
288 |
289 | vm.ChildWindowTitle = "My Custom Child Window Title Auto Find";
290 |
291 | _dialogService.ShowChildWindow(vm,
292 | model => { Message = $"Custom Child View Model Closed - {model.GetType()}"; });
293 | }
294 | }
295 |
296 | private void ChildWindowRememberPositionCommandExecuted()
297 | {
298 | var vm = Locator.Current.GetService();
299 | if (vm != null)
300 | {
301 | // these values can be stored in user settings and loaded at runtime etc.
302 | vm.RequestedLeft = MyUserSettings.Instance.Left;
303 | vm.RequestedTop = MyUserSettings.Instance.Top;
304 | vm.RequestedHeight = MyUserSettings.Instance.Height;
305 | vm.RequestedWidth = MyUserSettings.Instance.Width;
306 |
307 | vm.ChildWindowTitle = "My Custom Child Window Title Auto Find";
308 |
309 | _dialogService.ShowChildWindow(vm,
310 | model => { Message = $"Child Remember Position Closed - {model.GetType()}"; });
311 | }
312 | }
313 |
314 | private void MissingViewCommandExecuted()
315 | {
316 | var vm = Locator.Current.GetService();
317 |
318 | try
319 | {
320 | if (vm != null) _dialogService.ShowChildWindow(vm, model => { });
321 | }
322 | catch (Exception ex)
323 | {
324 | Message = ex.Message;
325 | }
326 | }
327 |
328 | private void WizardViewCommandExecuted()
329 | {
330 | var vm = Locator.Current.GetService();
331 | if (vm != null)
332 | {
333 | vm.RequestedLeft = MyUserSettings.Instance.Left;
334 | vm.RequestedTop = MyUserSettings.Instance.Top;
335 | vm.RequestedHeight = MyUserSettings.Instance.Height;
336 | vm.RequestedWidth = MyUserSettings.Instance.Width;
337 |
338 | vm.ChildWindowTitle = "My Wizard";
339 |
340 | _dialogService.StartWizard(vm, model => { Message = $"Wizard Closed - {model.GetType()}"; });
341 | }
342 | }
343 |
344 | private async void ShowMessageBoxCommandExecuted()
345 | {
346 | var resultOkCancel = await _messageBoxService.Show("OK Cancel", "Do you want to carry on?", MsgBoxButton.OkCancel, MsgBoxImage.Error);
347 | Message = $"{resultOkCancel.ButtonResult} clicked";
348 |
349 | var resultOk = await _messageBoxService.Show("Ok", "Do you want to carry on?", MsgBoxButton.Ok, MsgBoxImage.Information);
350 | Message = $"{resultOk.ButtonResult} clicked";
351 |
352 | var resultYesNo = await _messageBoxService.Show("Yes No", "Do you want to carry on?", MsgBoxButton.YesNo, MsgBoxImage.Asterisk);
353 | Message = $"{resultYesNo.ButtonResult} clicked";
354 |
355 | var resultYesNoCancel = await _messageBoxService.Show("Yes No Cancel", "Do you want to carry on?", MsgBoxButton.YesNoCancel, MsgBoxImage.Question);
356 | Message = $"{resultYesNoCancel.ButtonResult} clicked";
357 |
358 | var resultYesNoWarning = await _messageBoxService.Show("Yes No", "Do you want to carry on?", MsgBoxButton.YesNo, MsgBoxImage.Warning);
359 | Message = $"{resultYesNoWarning.ButtonResult} clicked";
360 |
361 | var resultYesNoNoIcon = await _messageBoxService.Show("Yes No Without Icon", "Do you want to carry on?", MsgBoxButton.YesNo);
362 | Message = $"{resultYesNoNoIcon.ButtonResult} clicked";
363 |
364 | var viewModel = new MsgBoxViewModel("Yes No With Icon", "Do you want to carry on?", MsgBoxButton.YesNo, MsgBoxImage.Forbidden);
365 | var resultVm = await _messageBoxService.Show(viewModel);
366 | Message = $"{resultVm.ButtonResult} clicked";
367 |
368 | var resultYesNoCancelCustomButtonText = await _messageBoxService.Show("German Yes No Cancel", "Möchten Sie weitermachen?", MsgBoxButton.YesNoCancel, MsgBoxImage.Wifi, "Nein", "Ja", "Abbrechen");
369 | Message = $"{resultYesNoCancelCustomButtonText.ButtonResult} clicked";
370 |
371 | var msgBoxResult = await _messageBoxService.Show("OK Cancel With Checkbox", "Do you want to carry on?", MsgBoxButton.OkCancel, MsgBoxImage.Error, checkBoxText:"Don't ask me again");
372 | Message = $"Button: {msgBoxResult.ButtonResult}, Checkbox: {msgBoxResult.CheckBoxResult}";
373 | }
374 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/MyChildWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using JamSoft.AvaloniaUI.Dialogs.Events;
3 | using JamSoft.AvaloniaUI.Dialogs.Sample.Models;
4 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
5 |
6 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
7 |
8 | public class MyChildWindowViewModel : ChildWindowViewModel
9 | {
10 | private string? _childMessage;
11 | private ObservableCollection? _comboboxItems;
12 | private ComboBoxItemViewModel? _selectedItem;
13 |
14 | public MyChildWindowViewModel()
15 | {
16 | RequestCloseDialog += OnRequestCloseDialog;
17 |
18 | ComboboxItems = new ObservableCollection
19 | {
20 | new ComboBoxItemViewModel { Name = string.Empty, Value = null },
21 | new ComboBoxItemViewModel { Name = "Item One", Value = 1 },
22 | new ComboBoxItemViewModel { Name = "Item Two", Value = 2 },
23 | new ComboBoxItemViewModel { Name = "Item Three", Value = 3 }
24 | };
25 | }
26 |
27 | public string? ChildMessage
28 | {
29 | get => _childMessage;
30 | set => RaiseAndSetIfChanged(ref _childMessage, value);
31 | }
32 |
33 | public ObservableCollection? ComboboxItems
34 | {
35 | get => _comboboxItems;
36 | set => RaiseAndSetIfChanged(ref _comboboxItems, value);
37 | }
38 |
39 | public ComboBoxItemViewModel? SelectedItem
40 | {
41 | get => _selectedItem;
42 | set => RaiseAndSetIfChanged(ref _selectedItem, value);
43 | }
44 |
45 | private void OnRequestCloseDialog(object? sender, RequestCloseDialogEventArgs e)
46 | {
47 | MyUserSettings.Instance.Top = RequestedTop;
48 | MyUserSettings.Instance.Left = RequestedLeft;
49 | MyUserSettings.Instance.Width = RequestedWidth;
50 | MyUserSettings.Instance.Height = RequestedHeight;
51 |
52 | RequestCloseDialog -= OnRequestCloseDialog;
53 | }
54 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/MyDialogViewModel.cs:
--------------------------------------------------------------------------------
1 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
2 |
3 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
4 |
5 | public class MyDialogViewModel : DialogViewModel
6 | {
7 | private string? _dialogMessage;
8 |
9 | public string? DialogMessage
10 | {
11 | get => _dialogMessage;
12 | set => RaiseAndSetIfChanged(ref _dialogMessage , value);
13 | }
14 |
15 | public override bool CanAccept()
16 | {
17 | return !string.IsNullOrWhiteSpace(DialogMessage);
18 | }
19 |
20 | public override bool CanCancel()
21 | {
22 | return string.IsNullOrWhiteSpace(DialogMessage);
23 | }
24 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/MyWizardViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
3 |
4 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
5 |
6 | public class MyWizardViewModel : WizardViewModel
7 | {
8 | private string? _valueOne;
9 | private string? _valueTwo;
10 | private string? _valueThree;
11 | private string? _valueFour;
12 | private bool _wizardStepOneComplete;
13 | private bool _wizardStepTwoComplete;
14 | private bool _wizardStepThreeComplete;
15 | private bool _wizardStepFourComplete;
16 | private ObservableCollection? _comboboxItems;
17 | private ComboBoxItemViewModel? _selectedItem;
18 |
19 | public MyWizardViewModel()
20 | {
21 | ComboboxItems = new ObservableCollection
22 | {
23 | new ComboBoxItemViewModel { Name = string.Empty, Value = null },
24 | new ComboBoxItemViewModel { Name = "Item One", Value = 1 },
25 | new ComboBoxItemViewModel { Name = "Item Two", Value = 2 },
26 | new ComboBoxItemViewModel { Name = "Item Three", Value = 3 }
27 | };
28 | }
29 |
30 | public ObservableCollection? ComboboxItems
31 | {
32 | get => _comboboxItems;
33 | set => RaiseAndSetIfChanged(ref _comboboxItems, value);
34 | }
35 |
36 | public ComboBoxItemViewModel? SelectedItem
37 | {
38 | get => _selectedItem;
39 | set
40 | {
41 | RaiseAndSetIfChanged(ref _selectedItem, value);
42 | WizardStepOneComplete = !string.IsNullOrWhiteSpace(ValueOne) && value?.Value != null;
43 | }
44 | }
45 |
46 | public string? ValueOne
47 | {
48 | get => _valueOne;
49 | set
50 | {
51 | RaiseAndSetIfChanged(ref _valueOne, value);
52 | WizardStepOneComplete = !string.IsNullOrWhiteSpace(value) && SelectedItem?.Value != null;
53 | }
54 | }
55 |
56 | public string? ValueTwo
57 | {
58 | get => _valueTwo;
59 | set
60 | {
61 | RaiseAndSetIfChanged(ref _valueTwo, value);
62 | WizardStepTwoComplete = !string.IsNullOrWhiteSpace(value);
63 | }
64 | }
65 |
66 | public string? ValueThree
67 | {
68 | get => _valueThree;
69 | set
70 | {
71 | RaiseAndSetIfChanged(ref _valueThree, value);
72 | WizardStepThreeComplete = !string.IsNullOrWhiteSpace(value);
73 | }
74 | }
75 |
76 | public string? ValueFour
77 | {
78 | get => _valueFour;
79 | set
80 | {
81 | RaiseAndSetIfChanged(ref _valueFour, value);
82 | WizardStepFourComplete = !string.IsNullOrWhiteSpace(value);
83 | }
84 | }
85 |
86 | public bool WizardStepOneComplete
87 | {
88 | get => _wizardStepOneComplete;
89 | set => RaiseAndSetIfChanged(ref _wizardStepOneComplete, value);
90 | }
91 |
92 | public bool WizardStepTwoComplete
93 | {
94 | get => _wizardStepTwoComplete;
95 | set => RaiseAndSetIfChanged(ref _wizardStepTwoComplete, value);
96 | }
97 |
98 | public bool WizardStepThreeComplete
99 | {
100 | get => _wizardStepThreeComplete;
101 | set => RaiseAndSetIfChanged(ref _wizardStepThreeComplete, value);
102 | }
103 |
104 | public bool WizardStepFourComplete
105 | {
106 | get => _wizardStepFourComplete;
107 | set => RaiseAndSetIfChanged(ref _wizardStepFourComplete, value);
108 | }
109 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/SirNotAppearingInThisAppViewModel.cs:
--------------------------------------------------------------------------------
1 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
2 |
3 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
4 |
5 | public class SirNotAppearingInThisAppViewModel : ChildWindowViewModel
6 | {
7 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/ViewModels/ViewModelBase.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI;
2 |
3 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.ViewModels;
4 |
5 | public class ViewModelBase : ReactiveObject
6 | {
7 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/CustomBaseChildWindowView.axaml:
--------------------------------------------------------------------------------
1 |
7 |
8 | CUSTOM CHILD VIEW
9 | This is a completely custom dialog. The view model implements IChildWindowViewModel and the accompanying view is auto discovered based on the ViewModel / View naming convention.
10 | A CustomBaseChildWindowViewModel is joined with a CustomBaseChildWindowView instance at runtime.
11 | The same approach can be taken with modal dialogs by implementing the IDialogViewModel interface and calling the ShowDialog method on the IDialogService.
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/CustomBaseChildWindowView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Markup.Xaml;
4 |
5 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.Views;
6 |
7 | public partial class CustomBaseChildWindowView : UserControl
8 | {
9 | public CustomBaseChildWindowView()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | private void InitializeComponent()
15 | {
16 | AvaloniaXamlLoader.Load(this);
17 | }
18 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MainWindow.axaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Avalonia;
3 | using Avalonia.Controls;
4 | using Avalonia.Interactivity;
5 | using JamSoft.AvaloniaUI.Dialogs.Sample.Models;
6 |
7 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.Views;
8 |
9 | public partial class MainWindow : Window
10 | {
11 | public MainWindow()
12 | {
13 | InitializeComponent();
14 |
15 | this.AttachDevTools();
16 | }
17 |
18 | private void TopLevel_OnClosed(object? sender, EventArgs e)
19 | {
20 | MyUserSettings.Save();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyChildWindowView.axaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyChildWindowView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Markup.Xaml;
4 |
5 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.Views;
6 |
7 | public partial class MyChildWindowView : UserControl
8 | {
9 | public MyChildWindowView()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | private void InitializeComponent()
15 | {
16 | AvaloniaXamlLoader.Load(this);
17 | }
18 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyDialogView.axaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyDialogView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Markup.Xaml;
4 |
5 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.Views;
6 |
7 | public partial class MyDialogView : UserControl
8 | {
9 | public MyDialogView()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | private void InitializeComponent()
15 | {
16 | AvaloniaXamlLoader.Load(this);
17 | }
18 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyWizardView.axaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
13 |
14 |
15 |
16 |
17 | Page 1
18 |
19 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | Page 2
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | Page 3
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Final Step
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyWizardView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace JamSoft.AvaloniaUI.Dialogs.Sample.Views;
5 |
6 | public partial class MyWizardView : UserControl
7 | {
8 | public MyWizardView()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | private void InitializeComponent()
14 | {
15 | AvaloniaXamlLoader.Load(this);
16 | }
17 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.Sample/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JamSoft.AvaloniaUI.Dialogs.Sample", "JamSoft.AvaloniaUI.Dialogs.Sample\JamSoft.AvaloniaUI.Dialogs.Sample.csproj", "{E96BA9F0-28A7-424B-8B7B-3F36C7D97BAF}"
4 | EndProject
5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JamSoft.AvaloniaUI.Dialogs", "JamSoft.AvaloniaUI.Dialogs\JamSoft.AvaloniaUI.Dialogs.csproj", "{C9D05C1A-6A85-4B87-A69E-D05D352BAB67}"
6 | EndProject
7 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{644815C4-7C07-43AE-9FBC-01A67BE642C6}"
8 | ProjectSection(SolutionItems) = preProject
9 | ..\README.md = ..\README.md
10 | ..\.gitlab-ci.yml = ..\.gitlab-ci.yml
11 | ..\_config.yml = ..\_config.yml
12 | EndProjectSection
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {E96BA9F0-28A7-424B-8B7B-3F36C7D97BAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {E96BA9F0-28A7-424B-8B7B-3F36C7D97BAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {E96BA9F0-28A7-424B-8B7B-3F36C7D97BAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {E96BA9F0-28A7-424B-8B7B-3F36C7D97BAF}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {C9D05C1A-6A85-4B87-A69E-D05D352BAB67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {C9D05C1A-6A85-4B87-A69E-D05D352BAB67}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {C9D05C1A-6A85-4B87-A69E-D05D352BAB67}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {C9D05C1A-6A85-4B87-A69E-D05D352BAB67}.Release|Any CPU.Build.0 = Release|Any CPU
28 | EndGlobalSection
29 | EndGlobal
30 |
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-120(-xxxhdpi).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-120(-xxxhdpi).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-23(-ldpi).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-23(-ldpi).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-30(-mdpi).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-30(-mdpi).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-45(-hdpi).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-45(-hdpi).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-60(-xhdpi).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-60(-xhdpi).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-90(-xxhdpi).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/Android/icons8-close-90(-xxhdpi).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/iOS/icons8-close-30(@1x).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/iOS/icons8-close-30(@1x).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/iOS/icons8-close-60(@2x).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/iOS/icons8-close-60(@2x).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/iOS/icons8-close-90(@3x).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/iOS/icons8-close-90(@3x).png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-120.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-240.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-30.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-480.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-480.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-60.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-90.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/CloseIcon/icons8-close-90.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/add.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/back-up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/back-up.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/ban.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/ban.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/battery-half.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/battery-half.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/check-circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/check-circle.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/cross-circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/cross-circle.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/customize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/customize.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/database.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/database.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/diamond-exclamation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/diamond-exclamation.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/exclamation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/exclamation.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/folder-open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/folder-open.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/info.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/interrogation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/interrogation.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Assets/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamsoft/JamSoft.AvaloniaUI.Dialogs/ef3c8958c583960d6c843fc78f36c71c27bdf330/src/JamSoft.AvaloniaUI.Dialogs/Assets/wifi.png
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Commands/DelegateCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Input;
2 |
3 | namespace JamSoft.AvaloniaUI.Dialogs.Commands;
4 |
5 | ///
6 | /// The default delegate command
7 | ///
8 | public class DelegateCommand : ICommand
9 | {
10 | private readonly Func? _canExecute;
11 | private readonly Action? _execute;
12 |
13 | ///
14 | /// The can execute changed handler
15 | ///
16 | public event EventHandler? CanExecuteChanged;
17 |
18 | ///
19 | /// The default constructor
20 | ///
21 | ///
22 | ///
23 | public DelegateCommand(Action? execute, Func? canExecute = null)
24 | {
25 | _execute = execute;
26 | _canExecute = canExecute;
27 | }
28 |
29 | ///
30 | /// The can execute method
31 | ///
32 | ///
33 | ///
34 | public bool CanExecute(object parameter)
35 | {
36 | if (_canExecute == null) return true;
37 | return _canExecute();
38 | }
39 |
40 | ///
41 | /// The execute method
42 | ///
43 | ///
44 | public void Execute(object parameter)
45 | {
46 | if (_execute == null) return;
47 | _execute();
48 | }
49 |
50 | ///
51 | /// Raises the can execute change event
52 | ///
53 | public void RaiseCanExecuteChanged()
54 | {
55 | if( CanExecuteChanged != null )
56 | {
57 | CanExecuteChanged(this, EventArgs.Empty);
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/src/JamSoft.AvaloniaUI.Dialogs/Controls/Wizard.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Input;
2 | using Avalonia;
3 | using Avalonia.Controls;
4 | using Avalonia.Controls.Metadata;
5 | using Avalonia.Controls.Presenters;
6 | using Avalonia.Controls.Primitives;
7 | using Avalonia.Controls.Templates;
8 | using Avalonia.Data;
9 | using Avalonia.Metadata;
10 | using JamSoft.AvaloniaUI.Dialogs.Commands;
11 | using JamSoft.AvaloniaUI.Dialogs.ViewModels;
12 |
13 | namespace JamSoft.AvaloniaUI.Dialogs.Controls
14 | {
15 | ///
16 | /// A wizard control that displays a series of elements in a workflow style progression.
17 | ///
18 | [TemplatePart("PART_StepsPresenter", typeof(ItemsControl))]
19 | [TemplatePart("PART_ButtonsPresenter", typeof(DockPanel))]
20 | public class Wizard : TemplatedControl
21 | {
22 | internal ContentPresenter? ContentPart;
23 |
24 | internal DockPanel? ButtonsPresenterPart { get; private set; }
25 |
26 | private Button? CompleteButton { get; set; }
27 |
28 | private Button? PreviousButton { get; set; }
29 |
30 | private Button? NextButton { get; set; }
31 |
32 | private ICommand MoveNextCommand => new DelegateCommand(MoveNextCommandExecuted);
33 | private ICommand MovePreviousCommand => new DelegateCommand(MovePreviousCommandExecuted);
34 |
35 | ///
36 | /// Gets or sets the selected item.
37 | ///
38 | public WizardStep? SelectedItem { get; set; }
39 |
40 | ///
41 | /// The index of the active WizardStep
42 | ///
43 | public int SelectedIndex { get; set; }
44 |
45 | ///
46 | /// Defines the property.
47 | ///
48 | public static readonly DirectProperty SelectedIndexProperty =
49 | AvaloniaProperty.RegisterDirect(
50 | nameof(SelectedIndex),
51 | o => o.SelectedIndex,
52 | (o, v) => o.SelectedIndex = v,
53 | unsetValue: 0,
54 | defaultBindingMode: BindingMode.OneWay);
55 |
56 | ///
57 | /// Defines the property.
58 | ///
59 | public static readonly DirectProperty SelectedItemProperty =
60 | AvaloniaProperty.RegisterDirect(
61 | nameof(SelectedItem),
62 | o => o.SelectedItem,
63 | (o, v) => o.SelectedItem = v,
64 | defaultBindingMode: BindingMode.OneWay, enableDataValidation: true);
65 |
66 | ///
67 | /// Defines the property.
68 | ///
69 | public static readonly StyledProperty ButtonPlacementProperty =
70 | AvaloniaProperty.Register(nameof(ButtonPlacement), defaultValue: Dock.Bottom);
71 |
72 | ///
73 | /// Defines the property.
74 | ///
75 | public static readonly StyledProperty ProgressPlacementProperty =
76 | AvaloniaProperty.Register(nameof(ProgressPlacement), defaultValue: Dock.Top);
77 |
78 | ///
79 | /// Defines the property.
80 | ///
81 | public static readonly StyledProperty ContentTemplateProperty =
82 | ContentControl.ContentTemplateProperty.AddOwner();
83 |
84 | ///
85 | /// The selected content property
86 | ///
87 | public static readonly StyledProperty