This commit is contained in:
TheXamlGuy
2024-07-06 22:04:56 +01:00
parent 0aa4c2d5d8
commit c0b166b970
9 changed files with 59 additions and 15 deletions
+12 -5
View File
@@ -7,9 +7,14 @@
Header="{Binding Key}" Header="{Binding Key}"
IsExpanded="False"> IsExpanded="False">
<SettingsExpander.Resources> <SettingsExpander.Resources>
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness> <Thickness x:Key="TextControlMargin">0</Thickness>
<Thickness x:Key="TextControlCompactThemePadding">0</Thickness> <Thickness x:Key="TextControlPadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactPadding">0</Thickness>
<Thickness x:Key="TextControlCompactMargin">0,-3,0,0</Thickness>
</SettingsExpander.Resources> </SettingsExpander.Resources>
<SettingsExpander.Action>
<ItemEntryActionView />
</SettingsExpander.Action>
<SettingsExpander.Footer> <SettingsExpander.Footer>
<Grid> <Grid>
<ComboBox <ComboBox
@@ -21,7 +26,7 @@
<ComboBox.Styles> <ComboBox.Styles>
<Style Selector="ComboBox.Write"> <Style Selector="ComboBox.Write">
<Setter Property="MaxWidth" Value="{Binding Width}" /> <Setter Property="MaxWidth" Value="{Binding Width}" />
<Setter Property="MinWidth" Value="{Binding Width}" /> <Setter Property="MinWidth" Value="{Binding Width}" />
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
<Style Selector="ComboBox.Read"> <Style Selector="ComboBox.Read">
@@ -48,7 +53,8 @@
<TextBox.Styles> <TextBox.Styles>
<Style Selector="TextBox.Write"> <Style Selector="TextBox.Write">
<Setter Property="IsVisible" Value="False" /> <Setter Property="IsVisible" Value="False" />
<Setter Property="Padding" Value="{StaticResource TextControlThemePadding}" /> <Setter Property="Margin" Value="{StaticResource TextControlMargin}" />
<Setter Property="Padding" Value="{StaticResource TextControlPadding}" />
</Style> </Style>
<Style Selector="TextBox.Read"> <Style Selector="TextBox.Read">
<Setter Property="MinWidth" Value="0" /> <Setter Property="MinWidth" Value="0" />
@@ -56,7 +62,8 @@
<Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactThemePadding}" /> <Setter Property="Margin" Value="{StaticResource TextControlCompactMargin}" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactPadding}" />
<Setter Property="MinHeight" Value="0" /> <Setter Property="MinHeight" Value="0" />
<Setter Property="Foreground"> <Setter Property="Foreground">
<Setter.Value> <Setter.Value>
+3
View File
@@ -10,6 +10,9 @@
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness> <Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactThemePadding">0</Thickness> <Thickness x:Key="TextControlCompactThemePadding">0</Thickness>
</SettingsExpander.Resources> </SettingsExpander.Resources>
<SettingsExpander.Action>
<ItemEntryActionView />
</SettingsExpander.Action>
<SettingsExpander.Footer> <SettingsExpander.Footer>
<Grid> <Grid>
<TextBox Text="{Binding Value}"> <TextBox Text="{Binding Value}">
+1 -1
View File
@@ -31,7 +31,7 @@
<TextBlock <TextBlock
FontSize="10" FontSize="10"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}" Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="BETA PREVIEW 2" /> Text="BETA PREVIEW 3" />
</Border> </Border>
</NavigationView.PaneHeader> </NavigationView.PaneHeader>
<NavigationView.PaneCustomContent> <NavigationView.PaneCustomContent>
@@ -10,6 +10,9 @@
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness> <Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactThemePadding">0</Thickness> <Thickness x:Key="TextControlCompactThemePadding">0</Thickness>
</SettingsExpander.Resources> </SettingsExpander.Resources>
<SettingsExpander.Action>
<ItemEntryActionView />
</SettingsExpander.Action>
<SettingsExpander.Footer> <SettingsExpander.Footer>
<MaskedTextBox Mask="{Binding Pattern}" Text="{Binding Value}"> <MaskedTextBox Mask="{Binding Pattern}" Text="{Binding Value}">
<TextBox.Styles> <TextBox.Styles>
+8 -4
View File
@@ -7,8 +7,10 @@
Header="{Binding Key}" Header="{Binding Key}"
IsExpanded="False"> IsExpanded="False">
<SettingsExpander.Resources> <SettingsExpander.Resources>
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness> <Thickness x:Key="TextControlMargin">0</Thickness>
<Thickness x:Key="TextControlCompactThemePadding">0</Thickness> <Thickness x:Key="TextControlPadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactPadding">0</Thickness>
<Thickness x:Key="TextControlCompactMargin">0,-3,0,0</Thickness>
</SettingsExpander.Resources> </SettingsExpander.Resources>
<SettingsExpander.Action> <SettingsExpander.Action>
<ItemEntryActionView /> <ItemEntryActionView />
@@ -19,7 +21,8 @@
<Style Selector="TextBox.Write"> <Style Selector="TextBox.Write">
<Setter Property="MaxWidth" Value="{Binding Width}" /> <Setter Property="MaxWidth" Value="{Binding Width}" />
<Setter Property="MinWidth" Value="{Binding Width}" /> <Setter Property="MinWidth" Value="{Binding Width}" />
<Setter Property="Padding" Value="{StaticResource TextControlThemePadding}" /> <Setter Property="Margin" Value="{StaticResource TextControlMargin}" />
<Setter Property="Padding" Value="{StaticResource TextControlPadding}" />
<Setter Property="TextWrapping" Value="NoWrap" /> <Setter Property="TextWrapping" Value="NoWrap" />
</Style> </Style>
<Style Selector="TextBox.Read"> <Style Selector="TextBox.Read">
@@ -27,7 +30,8 @@
<Setter Property="IsReadOnly" Value="True" /> <Setter Property="IsReadOnly" Value="True" />
<Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactThemePadding}" /> <Setter Property="Margin" Value="{StaticResource TextControlCompactMargin}" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactPadding}" />
<Setter Property="MinHeight" Value="0" /> <Setter Property="MinHeight" Value="0" />
<Setter Property="TextWrapping" Value="Wrap" /> <Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Foreground"> <Setter Property="Foreground">
+6 -2
View File
@@ -16,8 +16,10 @@ public partial class DropdownEntryViewModel :
ItemEntryConfiguration configuration, ItemEntryConfiguration configuration,
string key, string key,
object value, object value,
bool isConcealed,
bool isRevealed,
double width, double width,
DropdownValueViewModel selectedItem) : base(provider, factory, mediator, publisher, subscriber, disposer, items, state, configuration, key, value, width) DropdownValueViewModel selectedItem) : base(provider, factory, mediator, publisher, subscriber, disposer, items, state, configuration, key, value, isConcealed, isRevealed, width)
{ {
SelectedItem = selectedItem; SelectedItem = selectedItem;
} }
@@ -33,7 +35,9 @@ public partial class DropdownEntryViewModel :
ItemEntryConfiguration configuration, ItemEntryConfiguration configuration,
string key, string key,
object value, object value,
double width) : base(provider, factory, mediator, publisher, subscriber, disposer, items, state, configuration, key, value, width) bool isConcealed,
bool isRevealed,
double width) : base(provider, factory, mediator, publisher, subscriber, disposer, items, state, configuration, key, value, isConcealed, isRevealed, width)
{ {
} }
} }
+1 -1
View File
@@ -23,7 +23,7 @@ public class DropdownEntryViewModelHandler(IServiceFactory serviceFactory) :
DropdownValueViewModel? selected = values.FirstOrDefault(x => x.Value is not null && x.Value.Equals($"{value}")); DropdownValueViewModel? selected = values.FirstOrDefault(x => x.Value is not null && x.Value.Equals($"{value}"));
if (serviceFactory.Create<DropdownEntryViewModel>(args => args.Initialize(), if (serviceFactory.Create<DropdownEntryViewModel>(args => args.Initialize(),
[values, .. args.Parameters, configuration, label, value, width, false, false, selected]) [values, .. args.Parameters, configuration, label, value, false, false, width, selected ?? null])
is DropdownEntryViewModel viewModel) is DropdownEntryViewModel viewModel)
{ {
return Task.FromResult<IItemEntryViewModel?>(viewModel); return Task.FromResult<IItemEntryViewModel?>(viewModel);
+24
View File
@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Toolkit.Foundation; using Toolkit.Foundation;
namespace Wallet; namespace Wallet;
@@ -27,14 +28,25 @@ public partial class ItemEntryCollectionViewModel<TItem> :
ItemEntryConfiguration configuration, ItemEntryConfiguration configuration,
string key, string key,
object value, object value,
bool isConcealed,
bool isRevealed,
double width) : base(provider, factory, mediator, publisher, subscriber, disposer, key, value) double width) : base(provider, factory, mediator, publisher, subscriber, disposer, key, value)
{ {
this.configuration = configuration; this.configuration = configuration;
State = state; State = state;
IsConcealed = isConcealed;
IsRevealed = isRevealed;
Width = width; Width = width;
} }
[ObservableProperty]
private bool isConcealed;
[ObservableProperty]
private bool isRevealed;
[ObservableProperty] [ObservableProperty]
private double width; private double width;
@@ -50,6 +62,8 @@ public partial class ItemEntryCollectionViewModel<TItem> :
ItemEntryConfiguration configuration, ItemEntryConfiguration configuration,
string key, string key,
object value, object value,
bool isConcealed,
bool isRevealed,
double width) : base(provider, factory, mediator, publisher, subscriber, disposer, items, key, value) double width) : base(provider, factory, mediator, publisher, subscriber, disposer, items, key, value)
{ {
this.configuration = configuration; this.configuration = configuration;
@@ -84,4 +98,14 @@ public partial class ItemEntryCollectionViewModel<TItem> :
State = ItemState.Read; State = ItemState.Read;
return Task.CompletedTask; return Task.CompletedTask;
} }
[RelayCommand]
private void Hide() => IsRevealed = false;
[RelayCommand]
private void Reveal() => IsRevealed = true;
[RelayCommand]
private void Copy() => Publisher.Publish(Write.As(new Clipboard<object>($"{Value}")));
} }
+1 -2
View File
@@ -65,6 +65,5 @@ public partial class ItemEntryViewModel<TValue>(IServiceProvider provider,
private void Reveal() => IsRevealed = true; private void Reveal() => IsRevealed = true;
[RelayCommand] [RelayCommand]
private void Copy() => private void Copy() => Publisher.Publish(Write.As(new Clipboard<object>($"{Value}")));
Publisher.Publish(Write.As(new Clipboard<object>($"{Value}")));
} }