UserPage.axaml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:vm="using:AvaloniaApplicationTestNew.ViewModels"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. mc:Ignorable="d" d:DesignWidth="1400" d:DesignHeight="800"
  7. x:Class="AvaloniaApplicationTestNew.Views.UserPage"
  8. x:DataType="vm:MainWindowViewModel"
  9. xmlns:conv="using:AvaloniaApplicationTestNew.Resources">
  10. <UserControl.Resources>
  11. <conv:DateConverter x:Key="myDateTimeOffset"/>
  12. <conv:ImageConverter x:Key="myByteaBitmap"/>
  13. </UserControl.Resources>
  14. <Grid ColumnDefinitions="*,*" RowDefinitions="300, *">
  15. <StackPanel Grid.ColumnSpan="2" Grid.Row="0" Orientation="Vertical">
  16. <Image Source="{Binding UserPageVM.Current_user.Image, Converter={StaticResource myByteaBitmap}}" Width="200" Height="200"/>
  17. </StackPanel>
  18. <StackPanel Grid.Column="0" Grid.Row="1">
  19. <TextBox Watermark="Имя пользователя" Text="{Binding UserPageVM.Current_user.Name}"/>
  20. <DatePicker SelectedDate="{Binding UserPageVM.Current_user.BirthDate, Converter={StaticResource myDateTimeOffset}}"/>
  21. <ComboBox ItemsSource="{Binding UserPageVM.GendersList}" SelectedItem="{Binding UserPageVM.Current_user.IdGenderNavigation}">
  22. <ComboBox.ItemTemplate>
  23. <DataTemplate>
  24. <TextBlock Text="{Binding Gender1}"/>
  25. </DataTemplate>
  26. </ComboBox.ItemTemplate>
  27. </ComboBox>
  28. <Button Content="Выбрать аватарку пользователя" Command="{Binding UserPageVM.Image}"/>
  29. <Button Content="Удалить изображение" Command="{Binding UserPageVM.DeleteImage}"/>
  30. <Button Content="Сохранить изменения" Command="{Binding UserPageVM.SaveAndChange}"/>
  31. <Button Content="Выйти" Command="{Binding UserPageVM.Back}" IsVisible="{Binding !IsButtonVisible}"/>
  32. <Button Content="Удалить пользователя" IsVisible="{Binding IsButtonVisible}" Command="{Binding DeleteUser}"/>
  33. <Button Content="Назад" IsVisible="{Binding IsButtonVisible}" Command="{Binding BackToList}"/>
  34. <TextBlock Text="{Binding UserPageVM.Message}" Foreground="Red"/>
  35. </StackPanel>
  36. <StackPanel Grid.Column="1" Orientation="Vertical" Grid.Row="1">
  37. <ComboBox ItemsSource="{Binding UserPageVM.WithoutTraits}" SelectedItem="{Binding UserPageVM.SelectTrait}" Grid.Column="1">
  38. <ComboBox.ItemTemplate>
  39. <DataTemplate>
  40. <TextBlock Text="{Binding Traitname}"/>
  41. </DataTemplate>
  42. </ComboBox.ItemTemplate>
  43. </ComboBox>
  44. <StackPanel Grid.Column="1">
  45. <Button Content="Добавить качество" Command="{Binding UserPageVM.AddTrait}"/>
  46. <Button Content="Удалить качество" Command="{Binding UserPageVM.DeleteTrait}"/>
  47. </StackPanel>
  48. <TextBlock Foreground="Red" IsVisible="{Binding UserPageVM.IsReadyToDelete}" Text="Сначала выделите качество из списка, нажав на него"/>
  49. <ListBox ItemsSource="{Binding UserPageVM.WithTraits}" SelectedItem="{Binding UserPageVM.SelectItem}" Grid.Column="1">
  50. <ListBox.ItemTemplate>
  51. <DataTemplate>
  52. <TextBlock Text="{Binding Traitname}"/>
  53. </DataTemplate>
  54. </ListBox.ItemTemplate>
  55. </ListBox>
  56. </StackPanel>
  57. </Grid>
  58. </UserControl>