move stuff to a custom control
MODIFY
WalletWasabi.Fluent/App.xaml
WalletWasabi.Fluent/App.xaml
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"/>
<StyleInclude Source="avares://WalletWasabi.Fluent/Icons/Icons.xaml" />
<StyleInclude Source="avares://WalletWasabi.Fluent/Styles/Styles.xaml" />
+ <StyleInclude Source="avares://WalletWasabi.Fluent/Controls/DialogContentHost.xaml" />
<StyleInclude Source="avares://WalletWasabi.Fluent/Controls/NavBarItem.xaml" />
<StyleInclude Source="avares://WalletWasabi.Fluent/Controls/NavBarTreeItem.xaml" />
</Application.Styles>

ADD
WalletWasabi.Fluent/Controls/DialogContentHost.cs
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Mixins;
+using Avalonia.Controls.Primitives;
+using Avalonia.Metadata;
+
+namespace WalletWasabi.Fluent.Controls
+{
+ /// <summary>
+ /// Container for NavBarItems.
+ /// </summary>
+ public class DialogContentHost : TemplatedControl
+ {
+ public static readonly StyledProperty<object> ContentProperty =
+ AvaloniaProperty.Register<DialogContentHost, object>(nameof(Content));
+
+ public static readonly StyledProperty<bool> IsDialogOpenProperty =
+ AvaloniaProperty.Register<DialogContentHost, bool>(nameof(IsDialogOpen));
+
+ public DialogContentHost()
+ {
+ PseudoClasses.Set(":open", IsDialogOpen);
+ }
+
+ /// <summary>
+ /// The object to be displayed as a dialog.
+ /// </summary>
+ public object Content
+ {
+ get => GetValue(ContentProperty);
+ set => SetValue(ContentProperty, value);
+ }
+
+ /// <summary>
+ /// Gets or sets the activation state of the dialog.
+ /// </summary>
+ public bool IsDialogOpen
+ {
+ get => GetValue(IsDialogOpenProperty);
+ set => SetValue(IsDialogOpenProperty, value);
+ }
+ }
+}

ADD
WalletWasabi.Fluent/Controls/DialogContentHost.xaml
+<Styles xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls">
+ <Design.PreviewWith>
+ </Design.PreviewWith>
+ <Styles.Resources>
+ </Styles.Resources>
+ <Style Selector="c|DialogContentHost">
+ <Style.Animations>
+ <Animation Duration="2" Delay="2">
+ <KeyFrame Cue="0%">
+ <Setter Property="Opacity" Value="0"/>
+ </KeyFrame>
+ <KeyFrame Cue="100%">
+ <Setter Property="Opacity" Value="100"/>
+ </KeyFrame>
+ </Animation>
+ </Style.Animations>
+ <Setter Property="Template">
+ <ControlTemplate>
+ <Panel>
+ <Panel Background="#3A3A3A" Opacity="0.8" />
+ <Border MaxWidth="300" MaxHeight="200" CornerRadius="5" BoxShadow="4 11 30 1 #90000000" Background="#212121" >
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" FontSize="25">Hello World!</TextBlock>
+ </Border>
+ </Panel>
+ </ControlTemplate>
+ </Setter>
+ </Style>
+</Styles>
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Views/MainWindow.axaml
WalletWasabi.Fluent/Views/MainWindow.axaml
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WalletWasabi.Fluent.Views"
xmlns:vm="clr-namespace:WalletWasabi.Fluent.ViewModels;assembly=WalletWasabi.Fluent"
+ xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
<Panel Margin="{Binding #MainWindow.OffScreenMargin}">
<local:MainView />
- <Panel>
- <Panel Background="#3A3A3A" Opacity="0.8" />
-
- <Border MaxWidth="300" MaxHeight="200" CornerRadius="5" BoxShadow="4 11 30 1 #90000000" Background="#212121" >
- <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" FontSize="25">Hello World!</TextBlock>
- </Border>
- </Panel>
+ <c:DialogContentHost IsDialogOpen="{Binding IsDialogOpen}" Content="{Binding CurrentDialog}"/>
</Panel>
</Window>

move stuff to a custom control