|
- <UserControl x:Class="WPFDemo.TheListBox"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:WPFDemo"
- mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
- <ListView x:Name="listView"
- ItemsSource="{Binding ViewItems,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
- Background="{x:Null}" Foreground="White"
- PreviewMouseMove="ListView_PreviewMouseMove"
- PreviewMouseLeftButtonUp="lisbox_PreviewMouseLeftButtonUp">
- <ListBox.ItemTemplate>
- <ItemContainerTemplate>
- <Border x:Name="border" Tag="border" BorderBrush="Aquamarine" MouseLeftButtonDown="Border_MouseLeftButtonDown" BorderThickness="1" Padding="5" Background="#FF18888A">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="60"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <TextBlock Margin="10,0,10,0" Grid.Column="0" Text="{Binding Name,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
- <TextBlock Grid.Column="1" Text="{Binding Ph,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
- </Grid>
- </Border>
- </ItemContainerTemplate>
- </ListBox.ItemTemplate>
- </ListView>
- </UserControl>
|