Browse Source

Добавить 'README.md'

ababin 1 month ago
parent
commit
b3028e1a4d
1 changed files with 206 additions and 0 deletions
  1. 206 0
      README.md

+ 206 - 0
README.md

@@ -0,0 +1,206 @@
+## Вывод данных согласно макета (ListBox, Image).
+### MainWindow.xaml
+
+```
+<Window x:Class="WpfApp3.MainWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:WpfApp3"
+        mc:Ignorable="d"
+        Title="Musical Store" Height="450" Width="800">
+    <Window.Resources>
+        <BitmapImage
+            x:Key="defaultImage"
+            UriSource="./Images/20.-1.png"/>
+    </Window.Resources>
+    <Grid ShowGridLines="True">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="*" />
+            <RowDefinition Height="Auto" />
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="200"/>
+            <ColumnDefinition/>
+        </Grid.ColumnDefinitions>
+        <Image 
+        Source="./assets/Guitar.jpg" HorizontalAlignment="Center" Margin="0,50,0,50" Width="200" RenderTransformOrigin="0.5,0.5" Grid.RowSpan="3">
+            <Image.RenderTransform>
+                <TransformGroup>
+                    <ScaleTransform/>
+                    <SkewTransform/>
+                    <RotateTransform Angle="0"/>
+                    <TranslateTransform/>
+                </TransformGroup>
+            </Image.RenderTransform>
+        </Image>
+
+        <StackPanel Grid.Column="1" Orientation="Horizontal" Margin="10">
+            <Label Content="Фильтр:" VerticalAlignment="Center" />
+            <ComboBox x:Name="FilterComboBox" SelectionChanged="FilterComboBox_SelectionChanged" Margin="10" />
+            <Label Content="Поиск:" VerticalAlignment="Center" />
+            <TextBox Width="200" VerticalAlignment="Center" x:Name="SearchFilterTextBox" KeyUp="SearchFilter_KeyUp"/>
+        </StackPanel>
+
+        <StackPanel Grid.Column="1" Orientation="Vertical" Grid.Row="2" VerticalAlignment="Bottom">
+            <RadioButton GroupName="Sort" Tag="1" Content="по возрастанию" Checked="RadioButtonAsc_Checked" VerticalAlignment="Center"/>
+            <RadioButton GroupName="Sort" Tag="2" Content="по убыванию" Checked="RadioButtonDesc_Checked" VerticalAlignment="Center"/>
+            <Button x:Name="ExitButton" Content="Выход" Click="ExitButton_Click" Height="50"/>
+        </StackPanel>
+
+        <ListBox x:Name="InstrumentListView"
+            Grid.Row="1"
+            Background="White"
+            ItemsSource="{Binding InstrumentListView}" Grid.Column="1">
+            <ListBox.ItemContainerStyle>
+                <Style 
+                    TargetType="ListBoxItem">
+                    <Setter 
+                        Property="HorizontalContentAlignment"
+                        Value="Stretch" />
+                </Style>
+            </ListBox.ItemContainerStyle>
+            <ListBox.ItemTemplate>
+                <DataTemplate>
+                    <Border 
+                        BorderThickness="1" 
+                        BorderBrush="Black" 
+                        CornerRadius="5">
+                        <Grid 
+                            Margin="10" 
+                            HorizontalAlignment="Stretch">
+
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="64"/>
+                                <ColumnDefinition Width="*"/>
+                                <ColumnDefinition Width="auto"/>
+                            </Grid.ColumnDefinitions>
+                            <Image
+                                Width="64" 
+                                Height="64"
+                                Source="{Binding ImageBitmap,TargetNullValue={StaticResource defaultImage}}" />
+                            <StackPanel
+                                Grid.Column="1"
+                                Margin="5"
+                                Orientation="Vertical">
+
+                                <TextBlock 
+                                        Text="{Binding Name}"/>
+                                <TextBlock 
+                                        Text="{Binding Brand}"/>
+                                <TextBlock 
+                                        Grid.Column="2"
+                                        Text="{Binding Price}"/>
+                            </StackPanel>
+                        </Grid>
+                    </Border>
+                </DataTemplate>
+            </ListBox.ItemTemplate>
+        </ListBox>
+    </Grid>
+</Window>
+```
+## Вывод данных "плиткой"
+```
+<Window x:Class="WpfApp3.MainWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:WpfApp3"
+        mc:Ignorable="d"
+        Title="Musical Store" Height="450" Width="800">
+    <Window.Resources>
+        <BitmapImage
+            x:Key="defaultImage"
+            UriSource="./Images/20.-1.png"/>
+    </Window.Resources>
+    <Grid ShowGridLines="True">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="*" />
+            <RowDefinition Height="Auto" />
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="200"/>
+            <ColumnDefinition/>
+        </Grid.ColumnDefinitions>
+        <Image 
+        Source="./assets/Guitar.jpg" HorizontalAlignment="Center" Margin="0,50,0,50" Width="200" RenderTransformOrigin="0.5,0.5" Grid.RowSpan="3">
+            <Image.RenderTransform>
+                <TransformGroup>
+                    <ScaleTransform/>
+                    <SkewTransform/>
+                    <RotateTransform Angle="0"/>
+                    <TranslateTransform/>
+                </TransformGroup>
+            </Image.RenderTransform>
+        </Image>
+
+        <StackPanel Grid.Column="1" Orientation="Horizontal" Margin="10">
+            <Label Content="Фильтр:" VerticalAlignment="Center" />
+            <ComboBox x:Name="FilterComboBox" SelectionChanged="FilterComboBox_SelectionChanged" Margin="10" />
+            <Label Content="Поиск:" VerticalAlignment="Center" />
+            <TextBox Width="200" VerticalAlignment="Center" x:Name="SearchFilterTextBox" KeyUp="SearchFilter_KeyUp"/>
+        </StackPanel>
+
+        <StackPanel Grid.Column="1" Orientation="Vertical" Grid.Row="2" VerticalAlignment="Bottom">
+            <RadioButton GroupName="Sort" Tag="1" Content="по возрастанию" Checked="RadioButtonAsc_Checked" VerticalAlignment="Center"/>
+            <RadioButton GroupName="Sort" Tag="2" Content="по убыванию" Checked="RadioButtonDesc_Checked" VerticalAlignment="Center"/>
+            <Button x:Name="ExitButton" Content="Выход" Click="ExitButton_Click" Height="50"/>
+        </StackPanel>
+
+        <ListBox x:Name="InstrumentListView"
+            Grid.Row="1"
+            Background="White"
+            ItemsSource="{Binding InstrumentListView}" Grid.Column="1"
+            ScrollViewer.HorizontalScrollBarVisibility="Disabled">
+            <ListBox.ItemsPanel>
+                <ItemsPanelTemplate>
+                    <WrapPanel 
+                    HorizontalAlignment="Center" />
+                </ItemsPanelTemplate>
+            </ListBox.ItemsPanel>
+            <ListBox.ItemTemplate>
+                <DataTemplate>
+                    <Border 
+                        BorderThickness="1" 
+                        BorderBrush="Black" 
+                        CornerRadius="5"
+                        Width="250">
+                        <Grid 
+                            Margin="10" 
+                            HorizontalAlignment="Stretch">
+
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="64"/>
+                                <ColumnDefinition Width="*"/>
+                                <ColumnDefinition Width="auto"/>
+                            </Grid.ColumnDefinitions>
+                            <Image
+                                Width="64" 
+                                Height="64"
+                                Source="{Binding ImageBitmap,TargetNullValue={StaticResource defaultImage}}" />
+                            <StackPanel
+                                Grid.Column="1"
+                                Margin="5"
+                                Orientation="Vertical">
+
+                                <TextBlock 
+                                        Text="{Binding Name}"/>
+                                <TextBlock 
+                                        Text="{Binding Brand}"/>
+                                <TextBlock 
+                                        Grid.Column="2"
+                                        Text="{Binding Price}"/>
+                            </StackPanel>
+                        </Grid>
+                    </Border>
+                </DataTemplate>
+            </ListBox.ItemTemplate>
+        </ListBox>
+    </Grid>
+</Window>
+```