123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <Window x:Class="WpfAppA.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:WpfAppA"
- mc:Ignorable="d"
- Title="" Height="450" Width="740">
- <Window.Resources>
- <BitmapImage
- x:Key='defaultImage'
- UriSource='./Img/2.jpg' />
- <Style x:Key="VerticalListBoxStyle" TargetType="ListBox">
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <StackPanel Orientation="Vertical"/>
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ItemTemplate">
- <Setter.Value>
- <DataTemplate>
- <Border BorderThickness="2" BorderBrush="Black" CornerRadius="4" Margin="4">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="64"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="auto"/>
- </Grid.ColumnDefinitions>
- <Image Width="64" Height="64" Source="{Binding ImageBitmap}"/>
- <StackPanel Grid.Column="1" Orientation="Vertical" Margin="5,2,0,5">
- <TextBlock Text="{Binding name}"/>
- <TextBlock Text="{Binding power}"/>
- </StackPanel>
- <TextBlock Grid.Column="2" Text="{Binding Age}" Margin="0,2,10,0"/>
- </Grid>
- </Border>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!-- TileListBoxStyle -->
- <Style x:Key="TileListBoxStyle" TargetType="ListBox">
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <WrapPanel HorizontalAlignment="Center" ItemWidth="200"/>
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ItemTemplate">
- <Setter.Value>
- <DataTemplate>
- <Border BorderThickness="2" BorderBrush="Black" CornerRadius="5" Margin="5">
- <StackPanel Orientation="Vertical">
- <Image Width="200" Source="{Binding ImageBitmap}"/>
- <TextBlock Text="{Binding name}" HorizontalAlignment="Center"/>
- <TextBlock Text="{Binding power}" HorizontalAlignment="Center"/>
- <TextBlock Text="{Binding Age}" HorizontalAlignment="Center"/>
- </StackPanel>
- </Border>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Resources>
- <Grid ShowGridLines="True">
- <Grid.RowDefinitions>
- <RowDefinition Height="auto"/>
- <RowDefinition />
- <RowDefinition Height="auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="200"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <!-- типа логотип компании -->
- <Image
- Source="./img/portrait.jpg"
- Grid.RowSpan="2" HorizontalAlignment="Right"/>
- <StackPanel
- x:Name="buttonsStack"
- Background="White"
- >
- <Button
- x:Name="button1"
- Margin="10"
- Content="Играть"
- FontFamily="Verdana"
- Foreground="Black"
- Background="White"/>
- <Button
- x:Name="button2"
- Margin="10"
- Content="Настройки"
- FontFamily="Verdana"
- Foreground="Black"
- Background="White"/>
- </StackPanel>
- <ListBox
- Grid.Column="1"
- Grid.Row="1"
- Background="White"
- ItemsSource="{Binding HeroList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
- MouseDoubleClick="HeroListBox_MouseDoubleClick"
- x:Name="HeroListBox">
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel
- HorizontalAlignment="Center" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Border
- BorderThickness="1"
- BorderBrush="Black"
- CornerRadius="5">
- <Grid
- Width="200"
- Margin="10"
- HorizontalAlignment="Stretch">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="64"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="auto"/>
- </Grid.ColumnDefinitions>
- <!-- сюда потом вставить колонки -->
- <StackPanel
- Grid.Column="1"
- Margin="5"
- Orientation="Vertical">
- <TextBlock
- Text="{Binding name}"/>
- <TextBlock
- Text="{Binding race}"/>
- <TextBlock
- Grid.Column="2"
- Text="{Binding Age}"/>
- </StackPanel>
- <Image
- Width="64"
- Height="64"
- Source="{Binding ImageBitmap,TargetNullValue={StaticResource defaultImage}}"/>
-
- </Grid>
- </Border>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- <StackPanel
- Orientation="Vertical"
- Grid.RowSpan="3"
- VerticalAlignment="Bottom">
- <Button
- x:Name="ExitButton"
- Content="Выход"
- Click="ExitButton_Click"
- Height="50"/>
- </StackPanel>
- <WrapPanel
- Orientation="Horizontal"
- Grid.Column="1"
- MinHeight="50">
- <Label
- Content="Возраст:"
- VerticalAlignment="Center"/>
- <RadioButton
- GroupName="Age"
- Tag="1"
- Content="по возрастанию"
- IsChecked="True"
- Checked="RadioButton_Checked"
- VerticalAlignment="Center"/>
- <RadioButton
- GroupName="Age"
- Tag="2"
- Content="по убыванию "
- Checked="RadioButton_Checked"
- VerticalAlignment="Center"/>
- <Label
- Content="Искать:"
- VerticalAlignment="Center"/>
- <TextBox
- Width="200"
- VerticalAlignment="Center"
- x:Name="SearchFilterTextBox"
- KeyUp="SearchFilter_KeyUp"/>
- <Label
- Content="Мощь:"
- VerticalAlignment="Center"/>
- <ComboBox
- Name="powerFilterComboBox"
- SelectionChanged="powerFilterComboBox_SelectionChanged_1"
- VerticalAlignment="Center"
- MinWidth="100"
- SelectedIndex="0"
- ItemsSource="{Binding HeroPowerList}">
- <ComboBox.ItemTemplate>
- <DataTemplate>
- <Label
- Content="{Binding title}"/>
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
- <Label
- Content="Возраст:"
- VerticalAlignment="Center"/>
- <ComboBox
- Name="AgeFilterComboBox"
- SelectionChanged="AgeFilterComboBox_SelectionChanged_2"
- VerticalAlignment="Center"
- MinWidth="100"
- SelectedIndex="0"
- ItemsSource="{Binding HeroAgeList}">
- <ComboBox.ItemTemplate>
- <DataTemplate>
- <Label
- Content="{Binding title}"/>
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
- <Label
- Content="Раса:"
- VerticalAlignment="Center"/>
- <ComboBox
- Name="RaceFilterComboBox"
- SelectionChanged="RaceFilterComboBox_SelectionChanged_3"
- VerticalAlignment="Center"
- MinWidth="100"
- SelectedIndex="0"
- ItemsSource="{Binding HeroRaceList}">
- <ComboBox.ItemTemplate>
- <DataTemplate>
- <Label
- Content="{Binding title}"/>
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
- <!-- минимальную высоту я тут поставил, чтобы верхнюю строку сетки было видно. В реальном приложении она не нужна -->
- </WrapPanel>
- </Grid>
- </Window>
|