remove duplicate behavior decls and add it to base style instead.
MODIFY
WalletWasabi.Fluent/Behaviors/TriggerOnMinimumWidthBehavior.cs
WalletWasabi.Fluent/Behaviors/TriggerOnMinimumWidthBehavior.cs
@@ -7,16 +7,6 @@ namespace WalletWasabi.Fluent.Behaviors;
internal class TriggerOnMinimumWidthBehavior : DisposingBehavior<Control>
{
-
- public static readonly StyledProperty<Rect> BoundsProperty =
- AvaloniaProperty.Register<BoundsObserverBehavior, Rect>(nameof(Bounds), defaultBindingMode: BindingMode.OneWay);
-
- public Rect Bounds
- {
- get => GetValue(BoundsProperty);
- set => SetValue(BoundsProperty, value);
- }
-
public static readonly StyledProperty<double> MinimumWidthProperty = AvaloniaProperty.Register<TriggerOnMinimumWidthBehavior, double>(
"MinimumWidth");
@@ -41,7 +31,7 @@ internal class TriggerOnMinimumWidthBehavior : DisposingBehavior<Control>
{
if (AssociatedObject is not null)
{
- disposables.Add(this.GetObservable(BoundsProperty)
+ disposables.Add(AssociatedObject.GetObservable(Visual.BoundsProperty)
.Subscribe(bounds =>
{
if (bounds.Width < MinimumWidth)
@@ -52,7 +42,6 @@ internal class TriggerOnMinimumWidthBehavior : DisposingBehavior<Control>
{
AssociatedObject.Classes.Remove(ClassName);
}
-
}));
}

MODIFY
WalletWasabi.Fluent/Views/Shell/TitleBarView.axaml
WalletWasabi.Fluent/Views/Shell/TitleBarView.axaml
<UserControl.Styles>
<Style Selector="Panel#TitlePanel">
+ <Setter Property="Interaction.Behaviors">
+ <BehaviorCollectionTemplate>
+ <BehaviorCollection>
+
+ <behaviors:TriggerOnMinimumWidthBehavior MinimumWidth="150"
+ ClassName="minWidth" />
+ </BehaviorCollection>
+ </BehaviorCollectionTemplate>
+ </Setter>
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.100" />
<ContentControl ContentTemplate="{StaticResource WasabiLogo}" />
<Panel x:Name="TitlePanel" Grid.Column="1" Grid.ColumnSpan="2">
- <Interaction.Behaviors>
- <behaviors:TriggerOnMinimumWidthBehavior Bounds="{Binding #TitlePanel.Bounds}"
- MinimumWidth="150"
- ClassName="minWidth" />
- </Interaction.Behaviors>
<ContentControl ContentTemplate="{StaticResource Title}" />
</Panel>
<ContentControl Grid.Column="3" ContentTemplate="{StaticResource SearchBar}" />
<DockPanel Grid.Column="1">
<ContentControl ContentTemplate="{StaticResource WasabiLogo}" />
<Panel x:Name="TitlePanel">
- <Interaction.Behaviors>
- <behaviors:TriggerOnMinimumWidthBehavior Bounds="{Binding #TitlePanel.Bounds}"
- MinimumWidth="150"
- ClassName="minWidth" />
- </Interaction.Behaviors>
<ContentControl ContentTemplate="{StaticResource Title}" />
</Panel>
</DockPanel>

remove duplicate behavior decls and add it to base style instead.