Extract NetworkBadgeView
Keep things simple.
ADD
WalletWasabi.Fluent/Views/Shell/NetworkBadgeView.axaml
+<UserControl xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:viewModels="clr-namespace:WalletWasabi.Fluent.ViewModels"
+ x:DataType="viewModels:MainViewModel"
+ x:Class="WalletWasabi.Fluent.Views.Shell.NetworkBadgeView"
+ x:CompileBindings="True">
+
+ <UserControl.Styles>
+ <Style Selector="Border.NetworkBadge">
+ <Setter Property="CornerRadius" Value="3" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ <Setter Property="HorizontalAlignment" Value="Right" />
+ <Setter Property="Background" Value="Gold" />
+ </Style>
+ <Style Selector="Border.NetworkBadge TextBlock">
+ <Setter Property="Margin" Value="5" />
+ <Setter Property="FontWeight" Value="Bold" />
+ <Setter Property="Foreground" Value="Black" />
+ </Style>
+ </UserControl.Styles>
+
+ <Border IsHitTestVisible="False" Classes="NetworkBadge">
+ <TextBlock Text="{Binding NetworkBadgeName}" />
+ </Border>
+
+</UserControl>

ADD
WalletWasabi.Fluent/Views/Shell/NetworkBadgeView.axaml.cs
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace WalletWasabi.Fluent.Views.Shell;
+public partial class NetworkBadgeView : UserControl
+{
+ public NetworkBadgeView()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+}

MODIFY
WalletWasabi.Fluent/Views/Shell/TitleBarView.axaml
WalletWasabi.Fluent/Views/Shell/TitleBarView.axaml
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.Views.SearchBar"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800"
+ xmlns:shell="clr-namespace:WalletWasabi.Fluent.Views.Shell"
+ mc:Ignorable="d" d:DesignWidth="1000"
x:Class="WalletWasabi.Fluent.Views.Shell.TitleBarView"
x:Name="UserControl">
<Setter Property="Opacity" Value="0" />
<Setter Property="RenderTransform" Value="translateX(-20px)" />
</Style>
- <Style Selector="Border.NetworkBadge">
- <Setter Property="CornerRadius" Value="3" />
- <Setter Property="VerticalAlignment" Value="Center" />
- <Setter Property="HorizontalAlignment" Value="Right" />
- <Setter Property="Background" Value="Gold" />
- <Setter Property="Margin" Value="0 0 10 0" />
- </Style>
- <Style Selector="Border.NetworkBadge TextBlock">
- <Setter Property="Margin" Value="5" />
- <Setter Property="FontWeight" Value="Bold" />
- <Setter Property="Foreground" Value="Black" />
- </Style>
+
</UserControl.Styles>
<UserControl.Resources>
<ContentControl Grid.Column="3" ContentTemplate="{StaticResource SearchBar}" />
- <Border IsHitTestVisible="False" Grid.Column="4" IsVisible="{Binding IsNetworkBadgeEnabled}" Classes="NetworkBadge">
- <TextBlock Text="{Binding NetworkBadgeName}" />
- </Border>
+ <shell:NetworkBadgeView VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 8 0" Grid.Column="4" />
</Grid>
</DataTemplate>
</Panel>
</DockPanel>
<ContentControl Grid.Column="2" ContentTemplate="{StaticResource SearchBar}" />
-
- <Border IsHitTestVisible="False" Grid.Column="3" IsVisible="{Binding IsNetworkBadgeEnabled}" Classes="NetworkBadge">
- <TextBlock Text="{Binding NetworkBadgeName}" />
- </Border>
+ <shell:NetworkBadgeView Grid.Column="3" />
</Grid>
</DataTemplate>
</UserControl.Resources>
- <ContentControl
- ContentTemplate="{ext:Platform {StaticResource WindowsAndLinuxLayout}, Osx={StaticResource MacOSLayout}}" />
+ <ContentControl ContentTemplate="{ext:Platform {StaticResource WindowsAndLinuxLayout}, Osx={StaticResource MacOSLayout}}" />
</UserControl>

Extract NetworkBadgeView

Keep things simple.