Keine Beschreibung

Капралов Александр Викторович 0b707253fe Обновить 'readme.md' vor 6 Monaten
bin 643a118ce2 lab vor 6 Monaten
img 643a118ce2 lab vor 6 Monaten
model 643a118ce2 lab vor 6 Monaten
obj 643a118ce2 lab vor 6 Monaten
App.xaml 0a81de0814 lab vor 6 Monaten
App.xaml.cs 0a81de0814 lab vor 6 Monaten
AssemblyInfo.cs 0a81de0814 lab vor 6 Monaten
MainWindow.xaml 643a118ce2 lab vor 6 Monaten
MainWindow.xaml.cs 643a118ce2 lab vor 6 Monaten
WpfAppA.csproj 643a118ce2 lab vor 6 Monaten
WpfAppA.csproj.user 0a81de0814 lab vor 6 Monaten
readme.md 0b707253fe Обновить 'readme.md' vor 6 Monaten

readme.md

wpf.listbox

<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="MainWindow" Height="450" Width="740">
    <Window.Resources>
        <BitmapImage 
        x:Key='defaultImage' 
        UriSource='./img/2.jpg' />
    </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"/>
        <ListBox 
            Grid.Column="1"
    Grid.Row="1"
    Background="White"
            ItemsSource="{Binding HeroList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
            <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>