You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
2.5 KiB
53 lines
2.5 KiB
<Window x:Class="ListBoxBindingSample.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:ListBoxBindingSample"
|
|
xmlns:model="clr-namespace:ListBoxBindingSample.Model"
|
|
mc:Ignorable="d"
|
|
Title="MainWindow" Height="400" Width="700">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="250"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ListBox x:Name="lstMain" Grid.Column="0" HorizontalAlignment="Stretch"
|
|
SelectionMode="Multiple"
|
|
SelectionChanged="lstMain_SelectionChanged">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="60"/>
|
|
<ColumnDefinition Width="20"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<TextBlock Grid.Column="0" Margin="2" Text="{Binding Name}"/>
|
|
<TextBlock Grid.Column="1" Margin="2" Text="{Binding Age}"/>
|
|
<ProgressBar Grid.Column="2" Margin="5" Width="150"
|
|
Minimum="0" Maximum="100"
|
|
Value="{Binding Point}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
|
|
<StackPanel Grid.Column="1">
|
|
<Label Content="<Students management>" Background="LightGray" FontWeight="Bold"/>
|
|
<Button x:Name="btnSelected" Content="Show selected students" Margin="5" Cursor="Hand"
|
|
Click="btnSelected_Click"/>
|
|
<Button x:Name="btnPrevStudent" Content="Prev. student" Margin="5" Cursor="Hand"
|
|
Click="btnPrevStudent_Click"/>
|
|
<Button x:Name="btnNextStudent" Content="Next student" Margin="5" Cursor="Hand"
|
|
Click="btnNextStudent_Click"/>
|
|
<Button x:Name="btnAll" Content="Show all students" Margin="5" Cursor="Hand"
|
|
Click="btnAll_Click"/>
|
|
</StackPanel>
|
|
|
|
<TextBox x:Name="tbxDisplay" Grid.Column="2"/>
|
|
</Grid>
|
|
</Window>
|
|
|