ShowHotelsPage.axaml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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="1000" d:DesignHeight="450"
  6. xmlns:views="using:AvaloniaApplicationTest.Views"
  7. xmlns:vm="using:AvaloniaApplicationTest.ViewModels"
  8. x:DataType="vm:MainWindowViewModel"
  9. x:Class="AvaloniaApplicationTest.Views.ShowHotelsPage">
  10. <Grid>
  11. <ScrollViewer>
  12. <StackPanel>
  13. <Button Command="{Binding ToTours}" Content="Назад" HorizontalAlignment="Left" Margin="10"/>
  14. <TextBlock Text="Отели" HorizontalAlignment="Center" FontSize="20" Margin="0,0,20,0"/>
  15. <TextBlock Text="{Binding PageHotels.HowManyShow}" Margin="10"/>
  16. <StackPanel Orientation="Horizontal">
  17. <TextBox Margin="15,5,0,0" Width="8" HorizontalAlignment="Left" Text="{Binding PageHotels.UserCount}"/>
  18. <Button Command="{Binding ToAdd}" Content="Добавить отель" Margin="30,10,10,10"/>
  19. </StackPanel>
  20. <ListBox ItemsSource="{Binding PageHotels.LBHotels}">
  21. <ListBox.ItemsPanel>
  22. <ItemsPanelTemplate>
  23. <WrapPanel HorizontalAlignment="Center"/>
  24. </ItemsPanelTemplate>
  25. </ListBox.ItemsPanel>
  26. <ListBox.ItemTemplate>
  27. <DataTemplate>
  28. <Border BorderBrush="#fac716" BorderThickness="1">
  29. <StackPanel Width="500" Height="200">
  30. <TextBlock Text="{Binding Name, StringFormat=Название отеля: {0}}" Margin="5"/>
  31. <TextBlock Text="{Binding Stars}" Margin="10"/>
  32. <TextBlock Text="{Binding CountryName, StringFormat=Страна: {0}}" Margin="5"/>
  33. <TextBlock Text="{Binding CountTours, StringFormat=Количество туров: {0}}" Margin="5"/>
  34. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10">
  35. <Button Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).ToChange}" CommandParameter="{Binding Id}" Margin="0,10,0,0" Width="100" Content="Изменить" HorizontalAlignment="Right"/>
  36. <Button Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).DeleteHotel}" CommandParameter="{Binding Id}" Margin="0,10,0,0" Width="100" Content="Удалить" HorizontalAlignment="Right"/>
  37. </StackPanel>
  38. </StackPanel>
  39. </Border>
  40. </DataTemplate>
  41. </ListBox.ItemTemplate>
  42. </ListBox>
  43. <StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">
  44. <Button Command="{Binding PageHotels.Back}" IsEnabled="{Binding PageHotels.CanBack}" Content="Назад" Width="100"/>
  45. <TextBlock Margin="100,0,100,0" Text="{Binding PageHotels.PageNumber, StringFormat=Страница {0}}"/>
  46. <Button Command="{Binding PageHotels.Next}" IsEnabled="{Binding PageHotels.CanNext}" Content="Вперед" Width="100"/>
  47. </StackPanel>
  48. </StackPanel>
  49. </ScrollViewer>
  50. </Grid>
  51. </UserControl>