wip
This commit is contained in:
@@ -10,8 +10,7 @@
|
|||||||
FooterMenuItemsSource="{Binding Footer}"
|
FooterMenuItemsSource="{Binding Footer}"
|
||||||
IsSettingsVisible="False"
|
IsSettingsVisible="False"
|
||||||
MenuItemTemplate="{Binding Template}"
|
MenuItemTemplate="{Binding Template}"
|
||||||
MenuItemsSource="{Binding SelectedItem}"
|
MenuItemsSource="{Binding #ListBox.SelectedItem}">
|
||||||
SelectionFollowsFocus="True">
|
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
|
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
|
||||||
<InvokeNavigationViewItemAction SelectedIndex="1" />
|
<InvokeNavigationViewItemAction SelectedIndex="1" />
|
||||||
@@ -31,19 +30,19 @@
|
|||||||
<TextBlock
|
<TextBlock
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
|
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
|
||||||
Text="BETA PREVIEW 3" />
|
Text="{ReflectionBinding SelectedItem.Name}" />
|
||||||
</Border>
|
</Border>
|
||||||
</NavigationView.PaneHeader>
|
</NavigationView.PaneHeader>
|
||||||
<NavigationView.PaneCustomContent>
|
<NavigationView.PaneCustomContent>
|
||||||
<Grid RowDefinitions="*,Auto">
|
<Grid RowDefinitions="*,Auto">
|
||||||
<OverflowListBox
|
<Overflow
|
||||||
x:Name="ListBox"
|
x:Name="ListBox"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
ItemTemplate="{ReflectionBinding Template}"
|
ItemTemplate="{ReflectionBinding Template}"
|
||||||
ItemsSource="{Binding}"
|
ItemsSource="{Binding}"
|
||||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
|
SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
|
||||||
<OverflowListBox.Resources>
|
<Overflow.Resources>
|
||||||
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SubtleFillColorTransparentBrush" />
|
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SubtleFillColorTransparentBrush" />
|
||||||
<x:Double x:Key="WalletItemSize">40</x:Double>
|
<x:Double x:Key="WalletItemSize">40</x:Double>
|
||||||
<CornerRadius x:Key="WalletItemCornerRadius">40</CornerRadius>
|
<CornerRadius x:Key="WalletItemCornerRadius">40</CornerRadius>
|
||||||
@@ -146,26 +145,26 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</OverflowListBox.Resources>
|
</Overflow.Resources>
|
||||||
<OverflowListBox.Styles>
|
<Overflow.Styles>
|
||||||
<Style Selector="OverflowListBox.Closed">
|
<Style Selector="Overflow.Closed">
|
||||||
<Setter Property="Margin" Value="1,2,1,0" />
|
<Setter Property="Margin" Value="1,2,1,0" />
|
||||||
<Style Selector="^ StackPanel">
|
<Style Selector="^ StackPanel">
|
||||||
<Setter Property="Orientation" Value="Vertical" />
|
<Setter Property="Orientation" Value="Vertical" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="OverflowListBox.Opened">
|
<Style Selector="Overflow.Opened">
|
||||||
<Setter Property="Margin" Value="12,2,12,0" />
|
<Setter Property="Margin" Value="12,2,12,0" />
|
||||||
<Style Selector="^ StackPanel">
|
<Style Selector="^ StackPanel">
|
||||||
<Setter Property="Orientation" Value="Horizontal" />
|
<Setter Property="Orientation" Value="Horizontal" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</OverflowListBox.Styles>
|
</Overflow.Styles>
|
||||||
<OverflowListBox.ItemsPanel>
|
<Overflow.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Spacing="6" />
|
<StackPanel Spacing="6" />
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</OverflowListBox.ItemsPanel>
|
</Overflow.ItemsPanel>
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="True">
|
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="True">
|
||||||
<AddClassAction ClassName="Opened" RemoveIfExists="True" />
|
<AddClassAction ClassName="Opened" RemoveIfExists="True" />
|
||||||
@@ -175,14 +174,20 @@
|
|||||||
<AddClassAction ClassName="Closed" RemoveIfExists="True" />
|
<AddClassAction ClassName="Closed" RemoveIfExists="True" />
|
||||||
<RemoveClassAction ClassName="Opened" />
|
<RemoveClassAction ClassName="Opened" />
|
||||||
</DataTriggerBehavior>
|
</DataTriggerBehavior>
|
||||||
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].SelectedItem, Converter={NamedTypeConverter}}" Value="ManageNavigationViewModel">
|
<DataTriggerBehavior Binding="{Binding #ListBox.SelectedItem, Converter={NamedTypeConverter}}" Value="WalletNavigationViewModel">
|
||||||
|
<ChangePropertyAction
|
||||||
|
PropertyName="SelectedItem"
|
||||||
|
TargetObject="{Binding #NavigationView}"
|
||||||
|
Value="{x:Null}" />
|
||||||
|
</DataTriggerBehavior>
|
||||||
|
<DataTriggerBehavior Binding="{Binding #NavigationView.SelectedItem, Converter={NamedTypeConverter}}" Value="ManageNavigationViewModel">
|
||||||
<ChangePropertyAction
|
<ChangePropertyAction
|
||||||
PropertyName="SelectedItem"
|
PropertyName="SelectedItem"
|
||||||
TargetObject="{Binding #ListBox}"
|
TargetObject="{Binding #ListBox}"
|
||||||
Value="{x:Null}" />
|
Value="{x:Null}" />
|
||||||
</DataTriggerBehavior>
|
</DataTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
</OverflowListBox>
|
</Overflow>
|
||||||
<NavigationViewItemSeparator Grid.Row="1" />
|
<NavigationViewItemSeparator Grid.Row="1" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</NavigationView.PaneCustomContent>
|
</NavigationView.PaneCustomContent>
|
||||||
|
|||||||
@@ -12,19 +12,6 @@
|
|||||||
<CornerRadius x:Key="IconCornerRadius">40</CornerRadius>
|
<CornerRadius x:Key="IconCornerRadius">40</CornerRadius>
|
||||||
</ListBoxItem.Resources>
|
</ListBoxItem.Resources>
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<DataTriggerBehavior Binding="{Binding IsOpened}" Value="False">
|
|
||||||
<ConditionAction>
|
|
||||||
<ConditionAction.Condition>
|
|
||||||
<ConditionalExpression ForwardChaining="And">
|
|
||||||
<ComparisonCondition LeftOperand="{Binding IsSelected}" RightOperand="True" />
|
|
||||||
</ConditionalExpression>
|
|
||||||
</ConditionAction.Condition>
|
|
||||||
<NavigateAction Region="Main" Route="OpenWallet">
|
|
||||||
<Parameter Key="Name" Value="{Binding Name}" />
|
|
||||||
<Parameter Key="ImageDescriptor" Value="{Binding ImageDescriptor}" />
|
|
||||||
</NavigateAction>
|
|
||||||
</ConditionAction>
|
|
||||||
</DataTriggerBehavior>
|
|
||||||
<AttachedEventTriggerBehaviour RoutedEvent="{x:Static ListBoxExtension.ItemInvokedEvent}">
|
<AttachedEventTriggerBehaviour RoutedEvent="{x:Static ListBoxExtension.ItemInvokedEvent}">
|
||||||
<ConditionAction>
|
<ConditionAction>
|
||||||
<ConditionAction.Condition>
|
<ConditionAction.Condition>
|
||||||
|
|||||||
@@ -11,10 +11,26 @@ public class MainViewModelActivationHandler(IPublisher publisher,
|
|||||||
{
|
{
|
||||||
bool selected = true;
|
bool selected = true;
|
||||||
|
|
||||||
foreach (IComponentHost Wallet in Wallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>()
|
foreach (IComponentHost Wallet in Wallets.OrderBy(x =>
|
||||||
is IConfigurationDescriptor<WalletConfiguration> descriptor ? descriptor.Name : null))
|
|
||||||
{
|
{
|
||||||
if (Wallet.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>()
|
IConfigurationDescriptor<WalletConfiguration> descriptor = x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>();
|
||||||
|
return descriptor?.Name;
|
||||||
|
},
|
||||||
|
Comparer<string?>.Create((x, y) =>
|
||||||
|
{
|
||||||
|
bool xIsNumeric = int.TryParse(x, out int xNum);
|
||||||
|
bool yIsNumeric = int.TryParse(y, out int yNum);
|
||||||
|
|
||||||
|
return (xIsNumeric, yIsNumeric) switch
|
||||||
|
{
|
||||||
|
(true, true) => xNum.CompareTo(yNum),
|
||||||
|
(true, false) => -1,
|
||||||
|
(false, true) => 1,
|
||||||
|
_ => string.Compare(x, y, StringComparison.Ordinal)
|
||||||
|
};
|
||||||
|
})))
|
||||||
|
{
|
||||||
|
if (Wallet.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>()
|
||||||
is IConfigurationDescriptor<WalletConfiguration> configuration)
|
is IConfigurationDescriptor<WalletConfiguration> configuration)
|
||||||
{
|
{
|
||||||
if (Wallet.Services.GetRequiredService<IServiceFactory>() is IServiceFactory factory)
|
if (Wallet.Services.GetRequiredService<IServiceFactory>() is IServiceFactory factory)
|
||||||
@@ -23,7 +39,7 @@ public class MainViewModelActivationHandler(IPublisher publisher,
|
|||||||
Wallet.Services.GetRequiredService<IDecoratorService<ProfileImage<IImageDescriptor>>>();
|
Wallet.Services.GetRequiredService<IDecoratorService<ProfileImage<IImageDescriptor>>>();
|
||||||
ProfileImage<IImageDescriptor>? profileImage = profileImageDecorator.Value;
|
ProfileImage<IImageDescriptor>? profileImage = profileImageDecorator.Value;
|
||||||
|
|
||||||
if (factory.Create<WalletNavigationViewModel>(args => args.Initialize(), configuration.Name, profileImage?.Value ?? null, selected)
|
if (factory.Create<WalletNavigationViewModel>(args => args.Initialize(), configuration.Name, profileImage?.Value ?? null, selected)
|
||||||
is WalletNavigationViewModel viewModel)
|
is WalletNavigationViewModel viewModel)
|
||||||
{
|
{
|
||||||
publisher.Publish(Create.As<IMainNavigationViewModel>(viewModel),
|
publisher.Publish(Create.As<IMainNavigationViewModel>(viewModel),
|
||||||
|
|||||||
@@ -50,4 +50,17 @@ public partial class OpenWalletViewModel :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//public override async Task OnActivated()
|
||||||
|
//{
|
||||||
|
// Publisher.Publish(Activated.As<Wallet>());
|
||||||
|
// await base.OnActivated();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//public override async Task OnDeactivated()
|
||||||
|
//{
|
||||||
|
// Publisher.Publish(Deactivated.As<Wallet>());
|
||||||
|
// await base.OnDeactivated();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
@@ -11,8 +11,27 @@ public class WalletActivatedHandler(IWalletHostCollection wallets,
|
|||||||
{
|
{
|
||||||
if (args.Sender is Wallet<IComponentHost> wallet && wallet.Value is IComponentHost host)
|
if (args.Sender is Wallet<IComponentHost> wallet && wallet.Value is IComponentHost host)
|
||||||
{
|
{
|
||||||
List<IComponentHost> sortedWallets = [.. wallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is
|
List<IComponentHost> sortedWallets =
|
||||||
IConfigurationDescriptor<WalletConfiguration> descriptor ? descriptor.Name : null)];
|
[
|
||||||
|
.. wallets.OrderBy(wallet =>
|
||||||
|
{
|
||||||
|
var descriptor = wallet.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>();
|
||||||
|
return descriptor?.Name;
|
||||||
|
},
|
||||||
|
Comparer<string?>.Create((x, y) =>
|
||||||
|
{
|
||||||
|
bool xIsNumeric = int.TryParse(x, out int xNum);
|
||||||
|
bool yIsNumeric = int.TryParse(y, out int yNum);
|
||||||
|
|
||||||
|
return (xIsNumeric, yIsNumeric) switch
|
||||||
|
{
|
||||||
|
(true, true) => xNum.CompareTo(yNum),
|
||||||
|
(true, false) => -1,
|
||||||
|
(false, true) => 1,
|
||||||
|
_ => string.Compare(x, y, StringComparison.Ordinal)
|
||||||
|
};
|
||||||
|
})),
|
||||||
|
];
|
||||||
|
|
||||||
int index = sortedWallets.IndexOf(host);
|
int index = sortedWallets.IndexOf(host);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user