wip
This commit is contained in:
@@ -10,8 +10,7 @@
|
||||
FooterMenuItemsSource="{Binding Footer}"
|
||||
IsSettingsVisible="False"
|
||||
MenuItemTemplate="{Binding Template}"
|
||||
MenuItemsSource="{Binding SelectedItem}"
|
||||
SelectionFollowsFocus="True">
|
||||
MenuItemsSource="{Binding #ListBox.SelectedItem}">
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
|
||||
<InvokeNavigationViewItemAction SelectedIndex="1" />
|
||||
@@ -31,19 +30,19 @@
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
|
||||
Text="BETA PREVIEW 3" />
|
||||
Text="{ReflectionBinding SelectedItem.Name}" />
|
||||
</Border>
|
||||
</NavigationView.PaneHeader>
|
||||
<NavigationView.PaneCustomContent>
|
||||
<Grid RowDefinitions="*,Auto">
|
||||
<OverflowListBox
|
||||
<Overflow
|
||||
x:Name="ListBox"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Center"
|
||||
ItemTemplate="{ReflectionBinding Template}"
|
||||
ItemsSource="{Binding}"
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
|
||||
<OverflowListBox.Resources>
|
||||
<Overflow.Resources>
|
||||
<StaticResource x:Key="ListViewItemBackgroundSelected" ResourceKey="SubtleFillColorTransparentBrush" />
|
||||
<x:Double x:Key="WalletItemSize">40</x:Double>
|
||||
<CornerRadius x:Key="WalletItemCornerRadius">40</CornerRadius>
|
||||
@@ -146,26 +145,26 @@
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</OverflowListBox.Resources>
|
||||
<OverflowListBox.Styles>
|
||||
<Style Selector="OverflowListBox.Closed">
|
||||
</Overflow.Resources>
|
||||
<Overflow.Styles>
|
||||
<Style Selector="Overflow.Closed">
|
||||
<Setter Property="Margin" Value="1,2,1,0" />
|
||||
<Style Selector="^ StackPanel">
|
||||
<Setter Property="Orientation" Value="Vertical" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="OverflowListBox.Opened">
|
||||
<Style Selector="Overflow.Opened">
|
||||
<Setter Property="Margin" Value="12,2,12,0" />
|
||||
<Style Selector="^ StackPanel">
|
||||
<Setter Property="Orientation" Value="Horizontal" />
|
||||
</Style>
|
||||
</Style>
|
||||
</OverflowListBox.Styles>
|
||||
<OverflowListBox.ItemsPanel>
|
||||
</Overflow.Styles>
|
||||
<Overflow.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="6" />
|
||||
</ItemsPanelTemplate>
|
||||
</OverflowListBox.ItemsPanel>
|
||||
</Overflow.ItemsPanel>
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="True">
|
||||
<AddClassAction ClassName="Opened" RemoveIfExists="True" />
|
||||
@@ -175,14 +174,20 @@
|
||||
<AddClassAction ClassName="Closed" RemoveIfExists="True" />
|
||||
<RemoveClassAction ClassName="Opened" />
|
||||
</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
|
||||
PropertyName="SelectedItem"
|
||||
TargetObject="{Binding #ListBox}"
|
||||
Value="{x:Null}" />
|
||||
</DataTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</OverflowListBox>
|
||||
</Overflow>
|
||||
<NavigationViewItemSeparator Grid.Row="1" />
|
||||
</Grid>
|
||||
</NavigationView.PaneCustomContent>
|
||||
|
||||
@@ -12,19 +12,6 @@
|
||||
<CornerRadius x:Key="IconCornerRadius">40</CornerRadius>
|
||||
</ListBoxItem.Resources>
|
||||
<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}">
|
||||
<ConditionAction>
|
||||
<ConditionAction.Condition>
|
||||
|
||||
@@ -11,10 +11,26 @@ public class MainViewModelActivationHandler(IPublisher publisher,
|
||||
{
|
||||
bool selected = true;
|
||||
|
||||
foreach (IComponentHost Wallet in Wallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>()
|
||||
is IConfigurationDescriptor<WalletConfiguration> descriptor ? descriptor.Name : null))
|
||||
foreach (IComponentHost Wallet in Wallets.OrderBy(x =>
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (Wallet.Services.GetRequiredService<IServiceFactory>() is IServiceFactory factory)
|
||||
@@ -23,7 +39,7 @@ public class MainViewModelActivationHandler(IPublisher publisher,
|
||||
Wallet.Services.GetRequiredService<IDecoratorService<ProfileImage<IImageDescriptor>>>();
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
List<IComponentHost> sortedWallets = [.. wallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is
|
||||
IConfigurationDescriptor<WalletConfiguration> descriptor ? descriptor.Name : null)];
|
||||
List<IComponentHost> sortedWallets =
|
||||
[
|
||||
.. 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user