MainWindow.xaml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <Window x:Class="OOOWriteAndClear.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:OOOWriteAndClear"
  7. xmlns:db_models="clr-namespace:OOOWriteAndClear.DataBase"
  8. mc:Ignorable="d" Icon="/Resources/Images/icon.ico"
  9. Title="Пиши-стирай" Height="450" Width="800">
  10. <Window.Resources>
  11. <Style x:Key="MainItemsListView" TargetType="ListView">
  12. <Setter Property="ItemTemplate">
  13. <Setter.Value>
  14. <DataTemplate DataType="db_models:Product">
  15. <Grid Background="{Binding ItemBackground}">
  16. <Grid.ColumnDefinitions>
  17. <ColumnDefinition Width="auto"/>
  18. <ColumnDefinition/>
  19. <ColumnDefinition Width="auto"/>
  20. </Grid.ColumnDefinitions>
  21. <Image Grid.Column="0" Height="80" Width="80" Margin="0 0 10 0"
  22. Source="{Binding ImagePath}"/>
  23. <Grid Grid.Column="1">
  24. <Grid.RowDefinitions>
  25. <RowDefinition Height="auto"/>
  26. <RowDefinition Height="auto"/>
  27. <RowDefinition Height="auto"/>
  28. <RowDefinition Height="auto"/>
  29. </Grid.RowDefinitions>
  30. <TextBlock Grid.Row="0" Text="{Binding ProductName}"/>
  31. <TextBlock Grid.Row="1" Text="{Binding ProductDescription}" TextWrapping="Wrap"/>
  32. <TextBlock Grid.Row="2" Text="{Binding Manufacturer.ManufacturerName, StringFormat=Производитель: {0}}"/>
  33. <StackPanel Orientation="Horizontal" Grid.Row="3">
  34. <TextBlock Text="Цена: "/>
  35. <TextBlock Text="{Binding ProductCost}"
  36. TextDecorations="Strikethrough"/>
  37. <TextBlock Text="{Binding CostWithDiscount, StringFormat={} {0:f2} руб.}"/>
  38. </StackPanel>
  39. </Grid>
  40. <TextBlock Grid.Column="2" Text="{Binding ProductDiscountMax, StringFormat={}{0:f2}%}" VerticalAlignment="Center"/>
  41. </Grid>
  42. </DataTemplate>
  43. </Setter.Value>
  44. </Setter>
  45. </Style>
  46. </Window.Resources>
  47. <Border Padding="10" Name="MainBorder">
  48. <Grid>
  49. <Grid.RowDefinitions>
  50. <RowDefinition Height="auto"/>
  51. <RowDefinition Height="auto"/>
  52. <RowDefinition/>
  53. </Grid.RowDefinitions>
  54. <TextBlock Grid.Row="0"
  55. Text="Товары" HorizontalAlignment="Center"
  56. FontWeight="Bold"/>
  57. <Button HorizontalAlignment="Right" Height="30" Content="В корзину" Click="Button_Click_1"/>
  58. <Button Grid.Row="0" HorizontalAlignment="Left"
  59. BorderThickness="0" Background="Red"
  60. Foreground="White"
  61. Height="30" Width="30" Click="Button_Click">X</Button>
  62. <Grid Grid.Row="1">
  63. <Grid.ColumnDefinitions>
  64. <ColumnDefinition Width="auto"/>
  65. <ColumnDefinition Width="auto"/>
  66. <ColumnDefinition Width="auto"/>
  67. </Grid.ColumnDefinitions>
  68. <GroupBox Grid.Column="0" Header="Фильтрация по размеру скидки"
  69. Margin="0 0 10 0" >
  70. <ComboBox x:Name="FiltringCB" SelectionChanged="FiltringCB_SelectionChanged">
  71. <ComboBoxItem>Все диапазоны</ComboBoxItem>
  72. <ComboBoxItem>0-9,99%</ComboBoxItem>
  73. <ComboBoxItem>10-14,99%</ComboBoxItem>
  74. <ComboBoxItem>15% и более</ComboBoxItem>
  75. </ComboBox>
  76. </GroupBox>
  77. <GroupBox Grid.Column="1" Header="Сортировка по стоимости"
  78. Margin="0 0 10 0">
  79. <ComboBox x:Name="SortingCB" SelectionChanged="SortingCB_SelectionChanged">
  80. <ComboBoxItem>По возрастанию</ComboBoxItem>
  81. <ComboBoxItem>По убыванию</ComboBoxItem>
  82. </ComboBox>
  83. </GroupBox>
  84. <GroupBox Grid.Column="2" Width="300"
  85. Header="Поиск">
  86. <TextBox BorderThickness="0" x:Name="FindingTB" TextChanged="FindingTB_TextChanged"/>
  87. </GroupBox>
  88. </Grid>
  89. <ListView Name="ItemsListView"
  90. Grid.Row="2" Margin="0 10 0 0" d:ItemsSource="{d:SampleData ItemCount=5}"
  91. Style="{StaticResource MainItemsListView}" HorizontalContentAlignment="Stretch">
  92. <ListView.ContextMenu>
  93. <ContextMenu>
  94. <MenuItem Header="Добавить в заказ" Click="MenuItem_Click"></MenuItem>
  95. </ContextMenu>
  96. </ListView.ContextMenu>
  97. </ListView>
  98. </Grid>
  99. </Border>
  100. </Window>