Skip to content

Commit

Permalink
Added support for FluentAvalonia
Browse files Browse the repository at this point in the history
  • Loading branch information
mysteryx93 committed Jun 16, 2022
1 parent bbd5efa commit 69dfabc
Show file tree
Hide file tree
Showing 61 changed files with 1,800 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ All notable changes to this project will be documented in this file.
- Redesigned FrameworkDialogFactory to be simpler and more modular
- MessageBox for Avalonia is now split into a separate assembly `HanumanInstitute.MvvmDialogs.Avalonia.MessageBox`, since Avalonia doesn't have built-in support for message boxes
- `MvvmDialogs.Avalonia`, removed reference to MessageBox.Avalonia
- Added preliminary support for FluentAvalonia `HanumanInstitute.MvvmDialogs.Avalonia.Fluent`

TODO:
- Support icons with Fluent MessageBox TaskDialogs
- Support more complex usage of Fluent dialogs

## 1.2.3 - 2002-06-07

Expand Down
115 changes: 115 additions & 0 deletions MvvmDialogs.sln
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.ModalDialog.Tests", "s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MvvmDialogs.Avalonia.MessageBox", "src\MvvmDialogs.Avalonia.MessageBox\MvvmDialogs.Avalonia.MessageBox.csproj", "{7958C69B-C7A0-4CC4-8340-5C375E7AA722}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvvmDialogs.Avalonia.Fluent", "src\MvvmDialogs.Avalonia.Fluent\MvvmDialogs.Avalonia.Fluent.csproj", "{532FD258-141B-4FF9-8846-CD8396728E27}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.FluentContentDialog", "samples\Avalonia\Demo.FluentContentDialog\Demo.FluentContentDialog.csproj", "{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.FluentTaskDialog", "samples\Avalonia\Demo.FluentTaskDialog\Demo.FluentTaskDialog.csproj", "{23550E77-920B-47A2-AE2C-36204BFA9469}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.FluentMessageBoxContentDialog", "samples\Avalonia\Demo.FluentMessageBoxContentDialog\Demo.FluentMessageBoxContentDialog.csproj", "{339BEC27-FD38-494E-9D96-7A43DE9B36B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.FluentMessageBoxTaskDialog", "samples\Avalonia\Demo.FluentMessageBoxTaskDialog\Demo.FluentMessageBoxTaskDialog.csproj", "{30F209A6-028C-4AF4-A34D-D32B6C0D3572}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -685,6 +695,106 @@ Global
{7958C69B-C7A0-4CC4-8340-5C375E7AA722}.Release|x64.Build.0 = Release|Any CPU
{7958C69B-C7A0-4CC4-8340-5C375E7AA722}.Release|x86.ActiveCfg = Release|Any CPU
{7958C69B-C7A0-4CC4-8340-5C375E7AA722}.Release|x86.Build.0 = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|ARM.ActiveCfg = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|ARM.Build.0 = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|ARM64.Build.0 = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|x64.ActiveCfg = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|x64.Build.0 = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|x86.ActiveCfg = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Debug|x86.Build.0 = Debug|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|Any CPU.Build.0 = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|ARM.ActiveCfg = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|ARM.Build.0 = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|ARM64.ActiveCfg = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|ARM64.Build.0 = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|x64.ActiveCfg = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|x64.Build.0 = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|x86.ActiveCfg = Release|Any CPU
{532FD258-141B-4FF9-8846-CD8396728E27}.Release|x86.Build.0 = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|ARM.Build.0 = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|ARM64.Build.0 = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|x64.ActiveCfg = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|x64.Build.0 = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|x86.ActiveCfg = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Debug|x86.Build.0 = Debug|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|Any CPU.Build.0 = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|ARM.ActiveCfg = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|ARM.Build.0 = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|ARM64.ActiveCfg = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|ARM64.Build.0 = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|x64.ActiveCfg = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|x64.Build.0 = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|x86.ActiveCfg = Release|Any CPU
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE}.Release|x86.Build.0 = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|ARM.ActiveCfg = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|ARM.Build.0 = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|ARM64.Build.0 = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|x64.ActiveCfg = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|x64.Build.0 = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|x86.ActiveCfg = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Debug|x86.Build.0 = Debug|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|Any CPU.Build.0 = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|ARM.ActiveCfg = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|ARM.Build.0 = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|ARM64.ActiveCfg = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|ARM64.Build.0 = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|x64.ActiveCfg = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|x64.Build.0 = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|x86.ActiveCfg = Release|Any CPU
{23550E77-920B-47A2-AE2C-36204BFA9469}.Release|x86.Build.0 = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|ARM.ActiveCfg = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|ARM.Build.0 = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|ARM64.Build.0 = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|x64.ActiveCfg = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|x64.Build.0 = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|x86.ActiveCfg = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Debug|x86.Build.0 = Debug|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|Any CPU.Build.0 = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|ARM.ActiveCfg = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|ARM.Build.0 = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|ARM64.ActiveCfg = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|ARM64.Build.0 = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|x64.ActiveCfg = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|x64.Build.0 = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|x86.ActiveCfg = Release|Any CPU
{339BEC27-FD38-494E-9D96-7A43DE9B36B4}.Release|x86.Build.0 = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|ARM.ActiveCfg = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|ARM.Build.0 = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|ARM64.Build.0 = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|x64.ActiveCfg = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|x64.Build.0 = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|x86.ActiveCfg = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Debug|x86.Build.0 = Debug|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|Any CPU.Build.0 = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|ARM.ActiveCfg = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|ARM.Build.0 = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|ARM64.ActiveCfg = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|ARM64.Build.0 = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|x64.ActiveCfg = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|x64.Build.0 = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|x86.ActiveCfg = Release|Any CPU
{30F209A6-028C-4AF4-A34D-D32B6C0D3572}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -722,6 +832,11 @@ Global
{20C76953-78BF-493C-BF15-AB67DC620D82} = {0CAFC532-721B-4CD0-B4CA-AF10F07BFD76}
{743EA3B7-51AE-4055-AA6B-A0232142F0C6} = {0A8EF671-0277-4F7A-B03D-C6E227020E86}
{7958C69B-C7A0-4CC4-8340-5C375E7AA722} = {958591BB-32C1-48C4-B5FA-11A2C5686814}
{532FD258-141B-4FF9-8846-CD8396728E27} = {958591BB-32C1-48C4-B5FA-11A2C5686814}
{3B8A071F-EAE4-427F-9CF5-09BFA4F856FE} = {0CAFC532-721B-4CD0-B4CA-AF10F07BFD76}
{23550E77-920B-47A2-AE2C-36204BFA9469} = {0CAFC532-721B-4CD0-B4CA-AF10F07BFD76}
{339BEC27-FD38-494E-9D96-7A43DE9B36B4} = {0CAFC532-721B-4CD0-B4CA-AF10F07BFD76}
{30F209A6-028C-4AF4-A34D-D32B6C0D3572} = {0CAFC532-721B-4CD0-B4CA-AF10F07BFD76}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {983A22B3-AE5B-4B67-A798-F6A6697B82A8}
Expand Down
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ public class App : Application

var build = Locator.CurrentMutable;
build.RegisterLazySingleton(() => (IDialogService)new DialogService(
new DialogManager(viewLocator: new ViewLocator()),
new DialogManager(
viewLocator: new ViewLocator(),
dialogFactory: new DialogFactory().AddMessageBox()),
viewModelFactory: x => Locator.Current.GetService(x)));

SplatRegistrations.Register<MainWindowViewModel>();
Expand Down Expand Up @@ -250,6 +252,34 @@ public class ViewLocator : ViewLocatorBase

For the moment there are no application-wide settings used for Avalonia.

### Avalonia.MessageBox

Avalonia has no built-in support for message boxes. This extension handles message box requests
using [MessageBox.Avalonia](https://github.com/AvaloniaCommunity/MessageBox.Avalonia) library.
1. Add a reference to `HanumanInstitute.MvvmDialogs.Avalonia.MessageBox`
2. Register the MessageBox handler on IDialogService like this:

```c#
new DialogService(new DialogManager(dialogFactory: new DialogFactory().AddMessageBox()))
```

### Avalonia.Fluent

[FluentAvalonia](https://github.com/amwx/FluentAvalonia/) brings more of Fluent design and WinUI controls into Avalonia.
1. Add a reference to `HanumanInstitute.MvvmDialogs.Avalonia.Fluent`
2. Register the handlers on IDialogService like this:

```c#
new DialogService(new DialogManager(dialogFactory: new DialogFactory().AddFluent(FluentMessageBoxType.ContentDialog)))
```

It will add `IDialogService.ShowContentDialogAsync` and `IDialogService.ShowTaskDialogAsync`.

Additionally, `AddFluent` takes a parameter specifying whether to handle `IDialogService.ShowMessageBoxAsync` calls with ContentDialog or with TaskDialog.


## IModalDialogViewModel / ICloseable / IActivable

All dialog ViewModels must implement `IModalDialogViewModel` to set `DialogResult` with the result of the dialog.
Expand Down
23 changes: 23 additions & 0 deletions samples/Avalonia/Demo.FluentContentDialog/App.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fluentContentDialog="clr-namespace:Demo.FluentContentDialog"
xmlns:sty="using:FluentAvalonia.Styling"
x:Class="Demo.FluentContentDialog.App">
<Application.DataTemplates>
<fluentContentDialog:ViewLocator/>
</Application.DataTemplates>

<Application.Styles>
<sty:FluentAvaloniaTheme />
<!-- <FluentTheme Mode="Light"/> -->
<Style Selector="Button">
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style Selector="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</Application.Styles>
</Application>
47 changes: 47 additions & 0 deletions samples/Avalonia/Demo.FluentContentDialog/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using HanumanInstitute.MvvmDialogs;
using HanumanInstitute.MvvmDialogs.Avalonia;
using Microsoft.Extensions.Logging;
using Splat;

namespace Demo.FluentContentDialog;

public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);

var build = Locator.CurrentMutable;
var loggerFactory = LoggerFactory.Create(builder => builder.AddFilter(logLevel => true).AddDebug());

build.RegisterLazySingleton(() => (IDialogService)new DialogService(
new DialogManager(
viewLocator: new ViewLocator(),
logger: loggerFactory.CreateLogger<DialogManager>(),
dialogFactory: new DialogFactory().AddFluent()),
viewModelFactory: x => Locator.Current.GetService(x)));

SplatRegistrations.Register<MainWindowViewModel>();
SplatRegistrations.SetupIOC();
}

public override void OnFrameworkInitializationCompleted()
{
GC.KeepAlive(typeof(DialogService));
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow
{
DataContext = MainWindow
};
}

base.OnFrameworkInitializationCompleted();
}

public static MainWindowViewModel MainWindow => Locator.Current.GetService<MainWindowViewModel>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.15" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.15" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.15" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Splat.DependencyInjection.SourceGenerator" Version="1.1.33">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\MvvmDialogs.Avalonia.Fluent\MvvmDialogs.Avalonia.Fluent.csproj" />
<ProjectReference Include="..\..\..\src\MvvmDialogs.Avalonia.MessageBox\MvvmDialogs.Avalonia.MessageBox.csproj" />
<ProjectReference Include="..\..\..\src\MvvmDialogs.Avalonia\MvvmDialogs.Avalonia.csproj" />
</ItemGroup>
</Project>
39 changes: 39 additions & 0 deletions samples/Avalonia/Demo.FluentContentDialog/MainWindow.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Window
x:Class="Demo.FluentContentDialog.MainWindow"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:fluentContentDialog="clr-namespace:Demo.FluentContentDialog"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="Demo - Message Box"
Width="300"
Height="200"
d:DataContext="{x:Static fluentContentDialog:App.MainWindow}">

<UniformGrid Columns="2" Rows="3">
<Button
Command="{Binding ShowMessageBoxWithMessageCommand}">
<TextBlock Text="Show message box with message" />
</Button>
<Button
Command="{Binding ShowMessageBoxWithCaptionCommand}">
<TextBlock Text="Show message box with caption" />
</Button>
<Button
Command="{Binding ShowMessageBoxWithButtonCommand}">
<TextBlock Text="Show message box with buttons" />
</Button>
<Button
Command="{Binding ShowMessageBoxWithIconCommand}">
<TextBlock Text="Show message box with icon" />
</Button>
<Button
Command="{Binding ShowMessageBoxWithDefaultResultCommand}">
<TextBlock Text="Show message box with default result" />
</Button>
<TextBlock TextWrapping="Wrap"
Text="{Binding Confirmation}" />
</UniformGrid>
</Window>
18 changes: 18 additions & 0 deletions samples/Avalonia/Demo.FluentContentDialog/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace Demo.FluentContentDialog;

public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
}

private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
}
Loading

0 comments on commit 69dfabc

Please sign in to comment.