wpf ListView怎么绑定和显示控件(不是绑定控件的属性)
1个回答
展开全部
<ListView Height="337" HorizontalAlignment="Left" Margin="421,148,0,0" Name="listView1" VerticalAlignment="Top" Width="169" SelectionChanged="listView1_SelectionChanged">
<ListView.Background>
<SolidColorBrush />
</ListView.Background>
<ListView.Template>
<ControlTemplate>
<Border CornerRadius="10" BorderBrush="RoyalBlue" BorderThickness="5">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" >
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</ListView.Template>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border Name="BD_Collector" CornerRadius="5" Background="DarkSeaGreen" Width="135" Height="30" Margin="2">
<Label Content="{Binding}" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="13" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="BD_Collector" Property="Background" Value="YellowGreen" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="BD_Collector" Property="Background" Value="DarkGreen" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询