Basket.xaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <Window x:Class="OOOWriteAndClear.Basket"
  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"
  9. Title="Basket" Height="450" Width="800">
  10. <Window.Resources>
  11. <Style x:Key="BasketSostavListView" TargetType="ListView">
  12. <Setter Property="ItemTemplate">
  13. <Setter.Value>
  14. <DataTemplate DataType="db_models:OrderProduct">
  15. <Grid>
  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 Product.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. <RowDefinition Height="auto"/>
  30. <RowDefinition Height="auto"/>
  31. </Grid.RowDefinitions>
  32. <TextBlock Grid.Row="0" Text="{Binding Product.ProductName}"/>
  33. <TextBlock Grid.Row="1" Text="{Binding Product.ProductDescription}" TextWrapping="Wrap"/>
  34. <TextBlock Grid.Row="2" Text="{Binding Product.Manufacturer.ManufacturerName, StringFormat=Производитель: {0}}"/>
  35. <TextBlock Grid.Row="3" Text="{Binding Product.ProductCost, StringFormat=Цена без скидки: {0:f2} руб.}"/>
  36. <TextBlock Grid.Row="4" Text="{Binding Product.CostWithDiscount, StringFormat=Цена со скидкой: {0:f2} руб.}"/>
  37. </Grid>
  38. <StackPanel Orientation="Vertical" Grid.Column="2" VerticalAlignment="Center">
  39. <Button Uid="{Binding Product.ProductArticleNumber}"
  40. Click="Button_Click"
  41. Content="+"
  42. Height="20"
  43. Width="20"/>
  44. <TextBlock Text="{Binding ProductAmount}" HorizontalAlignment="Center"/>
  45. <Button Uid="{Binding Product.ProductArticleNumber}"
  46. Click="Button_Click_1"
  47. Content="-"
  48. Height="20"
  49. Width="20"/>
  50. </StackPanel>
  51. </Grid>
  52. </DataTemplate>
  53. </Setter.Value>
  54. </Setter>
  55. </Style>
  56. </Window.Resources>
  57. <Grid>
  58. <Grid.ColumnDefinitions>
  59. <ColumnDefinition/>
  60. <ColumnDefinition Width="auto"/>
  61. </Grid.ColumnDefinitions>
  62. <Border Padding="10">
  63. <ListView Name="BasketListView" Grid.Column="0" BorderThickness="0" Style="{StaticResource BasketSostavListView}"
  64. d:ItemsSource="{d:SampleData ItemCount=5}" HorizontalContentAlignment="Stretch"/>
  65. </Border>
  66. <Grid Grid.Column="1" Width="160">
  67. <Grid.RowDefinitions>
  68. <RowDefinition Height="auto"/>
  69. <RowDefinition Height="auto"/>
  70. <RowDefinition Height="auto"/>
  71. </Grid.RowDefinitions>
  72. <GroupBox Margin="0 20 0 0" Grid.Row="0" Header="Цена без скидки" Height="40">
  73. <TextBlock x:Name="CostWithoutDisc"/>
  74. </GroupBox>
  75. <GroupBox Margin="0 10 0 0" Grid.Row="1" Header="Размер скидки" Height="40">
  76. <TextBlock x:Name="Disc"/>
  77. </GroupBox>
  78. <GroupBox Margin="0 10 0 0" Grid.Row="2" Header="Цена со скидкой" Height="40">
  79. <TextBlock x:Name="CostWithDisc"/>
  80. </GroupBox>
  81. </Grid>
  82. </Grid>
  83. </Window>