UserSelectorView.axaml 7.4 KB

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