Skip to content

Commit

Permalink
SubActionButton
Browse files Browse the repository at this point in the history
  • Loading branch information
ichthus1604 committed Apr 24, 2024
1 parent 4a2dfad commit a5e3eda
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 19 deletions.
43 changes: 43 additions & 0 deletions WalletWasabi.Fluent/Controls/UICommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Avalonia;
using System.Windows.Input;

namespace WalletWasabi.Fluent.Controls;

public class UICommand : AvaloniaObject, IUICommand
{
public static readonly StyledProperty<string> NameProperty =
AvaloniaProperty.Register<UICommand, string>(nameof(Name));

public static readonly StyledProperty<object> IconProperty =
AvaloniaProperty.Register<UICommand, object>(nameof(Icon));

public static readonly StyledProperty<ICommand> CommandProperty =
AvaloniaProperty.Register<UICommand, ICommand>(nameof(Command));

public static readonly StyledProperty<bool> IsDefaultProperty =
AvaloniaProperty.Register<UICommand, bool>(nameof(IsDefault));

public string Name
{
get => GetValue(NameProperty);
set => SetValue(NameProperty, value);
}

public object Icon
{
get => GetValue(IconProperty);
set => SetValue(IconProperty, value);
}

public ICommand Command
{
get => GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}

public bool IsDefault
{
get => GetValue(IsDefaultProperty);
set => SetValue(IsDefaultProperty, value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public SendViewModel(UiContext uiContext, IWalletModel walletModel, SendParamete

SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: true);

EnableBack = false;
EnableBack = parameters.IsManual;

this.ValidateProperty(x => x.To, ValidateToField);
this.ValidateProperty(x => x.AmountBtc, ValidateAmount);
Expand Down
33 changes: 15 additions & 18 deletions WalletWasabi.Fluent/Views/Wallets/WalletView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,22 @@
<TextBlock Text="Broadcast" />
</StackPanel>
</Button>
<Button Classes="function"
IsVisible="{Binding IsSendButtonVisible}"
Command="{Binding SendCommand}">
<StackPanel Orientation="Horizontal">
<PathIcon Data="{StaticResource wallet_action_send}" />
<TextBlock Text="Send" />
</StackPanel>
</Button>

<!-- Manual Control Button, needs to be replaced by SubActionButton-->
<Button Classes="function"
IsVisible="{Binding IsSendButtonVisible}"
Command="{Binding SendManualControlCommand}">
<StackPanel Orientation="Horizontal">
<PathIcon Data="{StaticResource wallet_action_send}" />
<TextBlock Text="Manual Control" />
</StackPanel>
</Button>

<SubActionButton Content="Subaction Button"
Icon="{StaticResource wallet_action_buy}"
Command="{Binding SendCommand}"
IsVisible="{Binding IsSendButtonVisible}">
<SubActionButton.SubCommands>
<UICommandCollection>
<UICommand Name="Manual Control" Command="{Binding SendManualControlCommand}">
<UICommand.Icon>
<PathIcon Data="{StaticResource wallet_action_send}"
Classes="Icon" />
</UICommand.Icon>
</UICommand>
</UICommandCollection>
</SubActionButton.SubCommands>
</SubActionButton>

<Button Classes="function"
Command="{Binding ReceiveCommand}">
Expand Down

0 comments on commit a5e3eda

Please sign in to comment.