Some fixes

Alignment, sizing, and selection indicator
This commit is contained in:
_Neo_
2026-01-05 17:30:16 +02:00
parent af59454e19
commit 925ae1652b
4 changed files with 30 additions and 39 deletions

View File

@@ -17,21 +17,16 @@
<viewModels:ProfileSelectorDialogViewModel /> <viewModels:ProfileSelectorDialogViewModel />
</Design.DataContext> </Design.DataContext>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowDefinitions="*,Auto"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowDefinitions="*,Auto">
<StackPanel> <Border BorderThickness="0" Padding="-3">
<ListBox <ListBox
MaxHeight="300"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Padding="-3"
Background="Transparent" Background="Transparent"
ItemsSource="{Binding Profiles}" ItemsSource="{Binding Profiles}"
SelectionChanged="ProfilesList_SelectionChanged"> SelectionChanged="ProfilesList_SelectionChanged">
<ListBox.ItemsPanel> <ListBox.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel <UniformGrid Columns="5" />
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ListBox.ItemsPanel> </ListBox.ItemsPanel>
<ListBox.Styles> <ListBox.Styles>
@@ -82,6 +77,6 @@
</DataTemplate> </DataTemplate>
</ListBox.DataTemplates> </ListBox.DataTemplates>
</ListBox> </ListBox>
</StackPanel> </Border>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -46,17 +46,15 @@ namespace Ryujinx.Ava.UI.ViewModels
}; };
} }
private int _selectedIndex = -1;
public int SelectedIndex public int SelectedIndex
{ {
get; get => _selectedIndex;
set set
{ {
field = value; _selectedIndex = value;
SelectedImage = value == -1 ? null : Images[value].Data;
SelectedImage = field == -1
? null
: Images[field].Data;
OnPropertyChanged(); OnPropertyChanged();
OnPropertyChanged(nameof(SelectedImage)); OnPropertyChanged(nameof(SelectedImage));
} }

View File

@@ -29,22 +29,27 @@
IsReadOnly="True" IsReadOnly="True"
Text="{Binding UserIdString}" /> Text="{Binding UserIdString}" />
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Right"> <Grid Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Stretch">
<Border <Border
Name="ImageBox" Name="ImageBox"
BorderBrush="{DynamicResource AppListHoverBackgroundColor}" BorderBrush="{DynamicResource AppListHoverBackgroundColor}"
BorderThickness="1"> BorderThickness="1"
<Panel> VerticalAlignment="Stretch">
<Grid>
<ui:SymbolIcon <ui:SymbolIcon
FontSize="70" FontSize="70"
Width="120" Width="120"
Height="120" Height="120"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource AppListHoverBackgroundColor}" Foreground="{DynamicResource AppListHoverBackgroundColor}"
Symbol="Camera" /> Symbol="Camera" />
<Image <Image
Name="ProfileImage" Name="ProfileImage"
Width="120" Width="120"
Height="120" Height="120"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="{Binding Image, Converter={x:Static helpers:BitmapArrayValueConverter.Instance}}" /> Source="{Binding Image, Converter={x:Static helpers:BitmapArrayValueConverter.Instance}}" />
<Border <Border
Margin="2" Margin="2"
@@ -65,21 +70,19 @@
<ui:SymbolIcon Symbol="Edit" /> <ui:SymbolIcon Symbol="Edit" />
<Button.Flyout> <Button.Flyout>
<MenuFlyout Placement="Bottom"> <MenuFlyout Placement="Bottom">
<MenuItem <MenuItem Header="{ext:Locale UserProfiles_ProfileImage_Import}"
Header="{ext:Locale UserProfiles_ProfileImage_Import}" Icon="{ext:Icon fa-solid fa-image}"
Icon="{ext:Icon fa-solid fa-image}" Click="Import_OnClick" />
Click="Import_OnClick" /> <MenuItem Header="{ext:Locale UserProfiles_ProfileImage_SelectAvatar}"
<MenuItem Icon="{ext:Icon fa-solid fa-floppy-disk}"
Header="{ext:Locale UserProfiles_ProfileImage_SelectAvatar}" Click="SelectFirmwareImage_OnClick" />
Icon="{ext:Icon fa-solid fa-floppy-disk}"
Click="SelectFirmwareImage_OnClick" />
</MenuFlyout> </MenuFlyout>
</Button.Flyout> </Button.Flyout>
</Button> </Button>
</Border> </Border>
</Panel> </Grid>
</Border> </Border>
</StackPanel> </Grid>
<StackPanel <StackPanel
Grid.Row="1" Grid.Row="1"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"

View File

@@ -19,21 +19,16 @@
<viewModels:UserProfileViewModel /> <viewModels:UserProfileViewModel />
</Design.DataContext> </Design.DataContext>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowDefinitions="*,Auto"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowDefinitions="*,Auto">
<StackPanel> <Border BorderThickness="0" Padding="-3">
<ListBox <ListBox
MaxHeight="300"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Padding="-3"
SelectionChanged="ProfilesList_SelectionChanged"
Background="Transparent" Background="Transparent"
ItemsSource="{Binding Profiles}"> ItemsSource="{Binding Profiles}"
SelectionChanged="ProfilesList_SelectionChanged">
<ListBox.ItemsPanel> <ListBox.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel <UniformGrid Columns="5" />
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal"/>
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ListBox.ItemsPanel> </ListBox.ItemsPanel>
<ListBox.Styles> <ListBox.Styles>
@@ -106,7 +101,7 @@
DataType="viewModels:BaseModel"> DataType="viewModels:BaseModel">
<Panel <Panel
Height="120" Height="120"
Width="100"> Width="106">
<Button <Button
MinWidth="50" MinWidth="50"
MinHeight="50" MinHeight="50"
@@ -124,7 +119,7 @@
</DataTemplate> </DataTemplate>
</ListBox.DataTemplates> </ListBox.DataTemplates>
</ListBox> </ListBox>
</StackPanel> </Border>
<StackPanel <StackPanel
Grid.Row="1" Grid.Row="1"
Margin="0,30,0,0" Margin="0,30,0,0"