ItemsControl使用1
2024-09-28 03:36:16
<ItemsControl ItemsSource="{Binding DataItemsSource}"> //绑定一个List
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Red" BorderThickness="0,0,0,1"> //实现底部横线
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Grid.Row="" Text="{Binding Text}"/>
<ItemsControl Grid.Row="" ItemsSource="{Binding ItemsSource}"> //绑定第二层List
<ItemsControl.Template> //样式模板
<ControlTemplate TargetType="{x:Type ItemsControl}">
<WrapPanel Orientation="Horizontal" IsItemsHost="True"> //实现横向排列
</WrapPanel>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate> //内层数据显示
<TextBlock>
<Run Text="{Binding xxxText/>
</TextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
只需展示内容,用 ItemsControl.
最新文章
- python3 购物程序
- 自己不懂的SQL语句用法
- Eclipse魔法堂:修改主题
- 快速理解JS的闭包
- ExtJS MVC 学习手记3
- [每日一题] 11gOCP 1z0-053 :2013-09-30 ASMCMD.......................................................8
- JAVA 在程序中存储和修改信息
- Facade模式——设计模式学习(转载)
- Go 从入门到精通(三)字符串,时间,流程控制,函数
- JS面向对象之原型链
- HashMap 实现及原理
- redis 系列25 哨兵Sentinel (高可用演示 下)
- Python3 tkinter基础 Checkbutton variable 多选钮是否被选中
- python安装与配置
- Mysql 的安装(压缩文件)和基本管理
- Android UiAutomator2.0
- Java集合中List,Set以及Map等集合体系详解(史上最全)
- RNN,LSTM,GRU简单图解:
- uvalive 3415 Guardian Of Decency
- 硬链接(hard link)和符号连接(symbolic link)