WPF学习
程序员文章站
2022-07-13 23:14:26
...
ListBox绑定详细
<ListBox ItemsSource="{Binding Nav}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MaterialDesignListBoxItem}">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Padding" Value="0"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#F5F5F5"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="#00A1D6"/>
<Setter Property="Background" Value="Transparent"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<RadioButton Width="210" Command="{Binding DataContext.ItemClick,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}}" CommandParameter="{Binding}">
<RadioButton.Style>
<Style>
</Style>
</RadioButton.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}"/>
</StackPanel>
</RadioButton>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
推荐阅读
-
Visual Studio 2015怎么改变WPF窗体程序的背景图片?
-
iOS学习笔记-139.RunLoop07——Runloop处理流程
-
Python学习笔记之os模块使用总结
-
IOS UI学习教程之使用代码创建button
-
IOS UI学习教程之区分NSBundle和NSURL(读取文件、写入文件)
-
7.1(java学习笔记)InetAddress&InetScoketAddress
-
java学习实验随笔-------如何从键盘输入数据并保存到数组中
-
IOS UI学习教程之设置UITextField各种属性
-
IOS UI学习教程之使用UIImageView控件制作动画
-
Python学习笔记(一)(基础入门之环境搭建)