MainPage.axaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  6. x:Class="AvaloniaApplication1.MainPage"
  7. xmlns:vm="using:AvaloniaApplication1.ViewModels"
  8. x:DataType="vm:MainPageViewModel"
  9. xmlns:conv="using:AvaloniaApplication1.Resources">
  10. <UserControl.Resources>
  11. <conv:ImageConverter x:Key="myImageConverter"/>
  12. </UserControl.Resources>
  13. <Grid RowDefinitions="50,*" Grid.Column="1" Grid.Row="1">
  14. <StackPanel Orientation="Horizontal">
  15. <TextBox Text="{Binding Search}" Width="200" Watermark="Введите имя: "></TextBox>
  16. <ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding SelectedGender}">
  17. <ComboBox.ItemTemplate>
  18. <DataTemplate>
  19. <TextBlock Text="{Binding Title}"/>
  20. </DataTemplate>
  21. </ComboBox.ItemTemplate>
  22. </ComboBox>
  23. <StackPanel Orientation="Horizontal">
  24. <RadioButton Content="По возрастанию" Command="{Binding OrderByAge}" CommandParameter="1"></RadioButton>
  25. <RadioButton Content="По убыванию" Command="{Binding OrderByAge}" CommandParameter="2"></RadioButton>
  26. </StackPanel>
  27. </StackPanel>
  28. <ListBox ItemsSource="{Binding Smeshariki}" Grid.Row="1">
  29. <ListBox.ItemTemplate>
  30. <DataTemplate>
  31. <StackPanel Orientation="Horizontal">
  32. <Image Source="{Binding Image, Converter= {StaticResource myImageConverter}}" Width="100" Height="100"/>
  33. <StackPanel Orientation="Horizontal">
  34. <StackPanel>
  35. <TextBlock Text="{Binding Name, StringFormat= Имя: {0}}"></TextBlock>
  36. <TextBlock Text="{Binding Animal, StringFormat= Животное: {0}}"></TextBlock>
  37. <TextBlock Text="{Binding Age, StringFormat= Возраст: {0}}"></TextBlock>
  38. <TextBlock Text="{Binding GenderNavigation.Title, StringFormat= Пол: {0}}"></TextBlock>
  39. <Button Content="Удалить" Command="{Binding $parent[UserControl].((vm:MainPageViewModel)DataContext).Drop}" CommandParameter="{Binding Id}"/>
  40. <Button Content="Изменить" Command="{Binding $parent[UserControl].((vm:MainPageViewModel)DataContext).Update}" CommandParameter="{Binding Id}"/>
  41. </StackPanel>
  42. <ListBox ItemsSource="{Binding IdProperties}" Width="150" IsVisible="{Binding IdProperties.Count}">
  43. <ListBox.ItemTemplate>
  44. <DataTemplate>
  45. <TextBlock Text="{Binding Title}" Foreground="Black"/>
  46. </DataTemplate>
  47. </ListBox.ItemTemplate>
  48. </ListBox>
  49. </StackPanel>
  50. </StackPanel>
  51. </DataTemplate>
  52. </ListBox.ItemTemplate>
  53. </ListBox>
  54. </Grid>
  55. </UserControl>