UserSelectorView.axaml
1 <UserControl 2 x:Class="Ryujinx.Ava.UI.Views.User.UserSelectorViews" 3 xmlns="https://github.com/avaloniaui" 4 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 5 xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" 6 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 7 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 8 xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers" 9 xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models" 10 xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" 11 xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" 12 d:DesignHeight="450" 13 MinWidth="500" 14 d:DesignWidth="800" 15 mc:Ignorable="d" 16 Focusable="True" 17 x:DataType="viewModels:UserProfileViewModel"> 18 <UserControl.Resources> 19 <helpers:BitmapArrayValueConverter x:Key="ByteImage" /> 20 </UserControl.Resources> 21 <Design.DataContext> 22 <viewModels:UserProfileViewModel /> 23 </Design.DataContext> 24 <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> 25 <Grid.RowDefinitions> 26 <RowDefinition /> 27 <RowDefinition Height="Auto" /> 28 </Grid.RowDefinitions> 29 <Border 30 CornerRadius="5" 31 BorderBrush="{DynamicResource AppListHoverBackgroundColor}" 32 BorderThickness="1"> 33 <ListBox 34 MaxHeight="300" 35 HorizontalAlignment="Stretch" 36 VerticalAlignment="Center" 37 SelectionChanged="ProfilesList_SelectionChanged" 38 Background="Transparent" 39 ItemsSource="{Binding Profiles}"> 40 <ListBox.ItemsPanel> 41 <ItemsPanelTemplate> 42 <WrapPanel 43 HorizontalAlignment="Left" 44 VerticalAlignment="Center" 45 Orientation="Horizontal"/> 46 </ItemsPanelTemplate> 47 </ListBox.ItemsPanel> 48 <ListBox.Styles> 49 <Style Selector="ListBoxItem"> 50 <Setter Property="Margin" Value="5 5 0 5" /> 51 <Setter Property="CornerRadius" Value="5" /> 52 </Style> 53 <Style Selector="Rectangle#SelectionIndicator"> 54 <Setter Property="Opacity" Value="0" /> 55 </Style> 56 </ListBox.Styles> 57 <ListBox.DataTemplates> 58 <DataTemplate 59 DataType="models:UserProfile"> 60 <Grid 61 PointerEntered="Grid_PointerEntered" 62 PointerExited="Grid_OnPointerExited"> 63 <Border 64 HorizontalAlignment="Stretch" 65 VerticalAlignment="Stretch" 66 ClipToBounds="True" 67 CornerRadius="5" 68 Background="{Binding BackgroundColor}"> 69 <StackPanel 70 HorizontalAlignment="Stretch" 71 VerticalAlignment="Stretch"> 72 <Image 73 Width="96" 74 Height="96" 75 HorizontalAlignment="Stretch" 76 VerticalAlignment="Top" 77 Source="{Binding Image, Converter={StaticResource ByteImage}}" /> 78 <TextBlock 79 HorizontalAlignment="Stretch" 80 MaxWidth="90" 81 Text="{Binding Name}" 82 TextAlignment="Center" 83 TextWrapping="Wrap" 84 TextTrimming="CharacterEllipsis" 85 MaxLines="2" 86 Margin="5" /> 87 </StackPanel> 88 </Border> 89 <Border 90 Margin="2" 91 Height="24" 92 Width="24" 93 CornerRadius="12" 94 HorizontalAlignment="Right" 95 VerticalAlignment="Top" 96 Background="{DynamicResource ThemeContentBackgroundColor}" 97 IsVisible="{Binding IsPointerOver}"> 98 <Button 99 MaxHeight="24" 100 MaxWidth="24" 101 MinHeight="24" 102 MinWidth="24" 103 CornerRadius="12" 104 Padding="0" 105 Click="EditUser"> 106 <ui:SymbolIcon Symbol="Edit" /> 107 </Button> 108 </Border> 109 </Grid> 110 </DataTemplate> 111 <DataTemplate 112 DataType="viewModels:BaseModel"> 113 <Panel 114 Height="118" 115 Width="96"> 116 <Button 117 MinWidth="50" 118 MinHeight="50" 119 MaxWidth="50" 120 MaxHeight="50" 121 CornerRadius="25" 122 Margin="10" 123 Padding="0" 124 HorizontalAlignment="Center" 125 VerticalAlignment="Center" 126 Click="AddUser"> 127 <ui:SymbolIcon Symbol="Add" /> 128 </Button> 129 <Panel.Styles> 130 <Style Selector="Panel"> 131 <Setter Property="Background" Value="{DynamicResource ListBoxBackground}"/> 132 </Style> 133 </Panel.Styles> 134 </Panel> 135 </DataTemplate> 136 </ListBox.DataTemplates> 137 </ListBox> 138 </Border> 139 <StackPanel 140 Grid.Row="1" 141 Margin="0 24 0 0" 142 HorizontalAlignment="Left" 143 Orientation="Horizontal" 144 Spacing="10"> 145 <Button 146 Click="ManageSaves" 147 Content="{locale:Locale UserProfilesManageSaves}" /> 148 <Button 149 Click="RecoverLostAccounts" 150 Content="{locale:Locale UserProfilesRecoverLostAccounts}" /> 151 </StackPanel> 152 <StackPanel 153 Grid.Row="1" 154 Margin="0 24 0 0" 155 HorizontalAlignment="Right" 156 Orientation="Horizontal"> 157 <Button 158 Click="Close" 159 Content="{locale:Locale UserProfilesClose}" /> 160 </StackPanel> 161 </Grid> 162 </UserControl>