MainWindow.xaml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <Window x:Class="trade_akapralov.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:trade_akapralov"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="800">
  9. <Grid ShowGridLines="True">
  10. <Grid.RowDefinitions>
  11. <RowDefinition Height="auto"/>
  12. <RowDefinition/>
  13. <RowDefinition Height="auto"/>
  14. </Grid.RowDefinitions>
  15. <Grid.ColumnDefinitions>
  16. <ColumnDefinition Width="200"/>
  17. <ColumnDefinition/>
  18. </Grid.ColumnDefinitions>
  19. <!-- ListBox с привязкой данных -->
  20. <ListBox
  21. Grid.Row="1"
  22. Grid.Column="1"
  23. Background="White"
  24. ItemsSource="{Binding ProductList}"
  25. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  26. Margin="3,3,0,0" RenderTransformOrigin="0.5,0.5">
  27. <ListBox.ItemContainerStyle>
  28. <Style TargetType="ListBoxItem">
  29. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  30. </Style>
  31. </ListBox.ItemContainerStyle>
  32. <ListBox.ItemTemplate>
  33. <DataTemplate>
  34. <Border BorderThickness="1" BorderBrush="Black" CornerRadius="5">
  35. <Grid Margin="10" HorizontalAlignment="Stretch">
  36. <Grid.ColumnDefinitions>
  37. <ColumnDefinition Width="64"/>
  38. <ColumnDefinition Width="*"/>
  39. <ColumnDefinition Width="auto"/>
  40. </Grid.ColumnDefinitions>
  41. <!-- Изображение продукта -->
  42. <Image Width="64" Height="64"
  43. HorizontalAlignment="Center">
  44. <Image.Source>
  45. <BitmapImage UriSource="{Binding ProductPhotoPath}" />
  46. </Image.Source>
  47. </Image>
  48. <!-- Данные продукта -->
  49. <StackPanel Grid.Column="1" Margin="5" Orientation="Vertical">
  50. <TextBlock Text="{Binding ProductDescription}" FontWeight="Bold" />
  51. <TextBlock Text="{Binding ManufacturerName}" />
  52. <TextBlock Text="{Binding ProductCost}" />
  53. </StackPanel>
  54. <!-- Производитель -->
  55. <TextBlock Grid.Column="2"
  56. Text="{Binding ProductQuantityInStock}"
  57. VerticalAlignment="Center"/>
  58. </Grid>
  59. </Border>
  60. </DataTemplate>
  61. </ListBox.ItemTemplate>
  62. </ListBox>
  63. <!-- Логотип -->
  64. <Image Source="/logo/Logo.png" Grid.RowSpan="2"/>
  65. <StackPanel Orientation="Vertical" Grid.RowSpan="3" VerticalAlignment="Bottom">
  66. <Button x:Name="ExitButton" Content="Выход" Click="ExitButton_Click" Height="54"/>
  67. </StackPanel>
  68. </Grid>
  69. </Window>