HotelPage.axaml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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="travel.Views.HotelPage"
  7. xmlns:vm="using:travel.ViewModels"
  8. x:DataType="vm:MainWindowViewModel">
  9. <Grid>
  10. <Grid.RowDefinitions>
  11. <RowDefinition Height="0.2*"/>
  12. <RowDefinition/>
  13. <RowDefinition Height="0.3*"/>
  14. </Grid.RowDefinitions>
  15. <StackPanel Orientation="Vertical">
  16. <StackPanel Orientation="Horizontal" Margin="5,10">
  17. <TextBlock Text="Количество элементов: " VerticalAlignment="Center"/>
  18. <TextBox Text="{Binding hp_VM.CountElem}" MaxHeight="10"/>
  19. </StackPanel>
  20. <Button Content="Туры" Margin="10" Command="{Binding GoPageTour}"/>
  21. </StackPanel>
  22. <StackPanel Grid.Row="1">
  23. <Button Content="Добавить" Margin="5" Command="{Binding GoHotelCard}" HorizontalAlignment="Right" Background="#bae3e8"/>
  24. <Button Content="Удалить" Margin="5" Command="{Binding GoPageTour}" HorizontalAlignment="Right" Background="#e31e24"/>
  25. </StackPanel>
  26. <ListBox ItemsSource="{Binding hp_VM.ListHotels}" Grid.Row="1" Margin="100,0">
  27. <ListBox.ItemsPanel>
  28. <ItemsPanelTemplate>
  29. <WrapPanel HorizontalAlignment="Center"/>
  30. </ItemsPanelTemplate>
  31. </ListBox.ItemsPanel>
  32. <ListBox.ItemTemplate>
  33. <DataTemplate>
  34. <Border CornerRadius="5" BorderBrush="Black" BorderThickness="2" Padding="10">
  35. <StackPanel Width="200" >
  36. <TextBlock Text="{Binding Name}" TextWrapping="Wrap"/>
  37. <TextBlock Text="{Binding StarString}" Foreground="#fac716"/>
  38. <TextBlock Text="{Binding CountryHotel}"/>
  39. <TextBlock Text="{Binding CountTour, StringFormat=Количество туров: {0}}"/>
  40. <Button Content="Изменить" Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).GoHotelCardChange}" CommandParameter="{Binding Id}" Background="#bae3e8"/>
  41. </StackPanel>
  42. </Border>
  43. </DataTemplate>
  44. </ListBox.ItemTemplate>
  45. </ListBox>
  46. <StackPanel Grid.Row="2">
  47. <Grid>
  48. <Grid.ColumnDefinitions>
  49. <ColumnDefinition/>
  50. <ColumnDefinition/>
  51. <ColumnDefinition/>
  52. </Grid.ColumnDefinitions>
  53. <StackPanel Orientation="Horizontal" Margin="5,25">
  54. <Button Content="&lt;&lt;" Command="{Binding hp_VM.Start}" Background="#878787"/>
  55. <Button Content="&lt;" Margin="15,0" Command="{Binding hp_VM.Back}" Background="#878787"/>
  56. </StackPanel>
  57. <StackPanel Orientation="Horizontal" Margin="5,25" Grid.Column="2" HorizontalAlignment="Right">
  58. <Button Content=">" Margin="15,0" Command="{Binding hp_VM.Next}" Background="#878787"/>
  59. <Button Content=">>" Command="{Binding hp_VM.End}" Background="#878787"/>
  60. </StackPanel>
  61. <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
  62. <TextBlock Text="{Binding hp_VM.T1}"/>
  63. <TextBlock Text=" / "/>
  64. <TextBlock Text="{Binding hp_VM.T2}"/>
  65. </StackPanel>
  66. </Grid>
  67. </StackPanel>
  68. </Grid>
  69. </UserControl>