WPF下Itemscontrol分组 样式
<ItemsControl Grid.Row="1" DataContext="{Binding Layouts}" ItemsSource="{Binding }">
<ItemsControl.GroupStyle>
<GroupStyle >
<GroupStyle.ContainerStyle >
<Style TargetType="{x:Type GroupItem}" >
<Setter Property="Margin" Value="0,0,0,10"/>
<Setter Property="Template" >
<Setter.Value >
<ControlTemplate TargetType="{x:Type GroupItem}">
<Border BorderBrush="Gray" BorderThickness="1" Margin="5,6,5,1">
<StackPanel >
<ContentPresenter />
<Border >
<ItemsPresenter />
</Border>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
<GroupStyle.HeaderTemplate >
<DataTemplate >
<TextBlock Name="txtgroup" FontSize="13" Foreground="#262679" Text="基本布局"/>
<DataTemplate.Triggers >
<DataTrigger Binding="{Binding Path=Name}" Value="Increase">
<Setter TargetName="txtgroup" Property="Text" Value="增强布局" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ItemsControl.GroupStyle>
<ItemsControl.ItemTemplate >
<DataTemplate >
<Button Command="{Binding SelectedStyleCommand}" CommandParameter="{Binding Tag}" Background="{Binding Img}"
Width="120" Height="80" Margin="10,10,0,10">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}">
<Border Name="bd001" CornerRadius="8" Background="{TemplateBinding Background}" BorderBrush="LightGray" BorderThickness="2">
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers >
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.85" TargetName="bd001"/>
<Setter Property="BorderBrush" Value="Red" TargetName="bd001"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel >
<ItemsPanelTemplate >
<UniformGrid Rows="2" Columns="4"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<!--<ItemsControl.ItemContainerStyle >
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" />
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="Red" />
</MultiTrigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Green" />
</Trigger>
</Style.Triggers>
</Style>
</ItemsControl.ItemContainerStyle>-->
</ItemsControl>
WPF下Itemscontrol分组 样式的更多相关文章
- WPF里ItemsControl的分组实现 --listbox 实现分组
我们在用到ItemsControl时,有时会用到分组,如ListBox,ListView,DataGrid.WPF的ItemsControl可以实现分组,是依托于GroupStyle,以ListBox ...
- WPF里ItemsControl的分组实现
我们在用到ItemsControl时,有时会用到分组,如ListBox,ListView,DataGrid.WPF的ItemsControl可以实现分组,是依托于GroupStyle,以ListBox ...
- WPF ScrollViewer(滚动条) 自定义样式表制作 图文并茂
原文:WPF ScrollViewer(滚动条) 自定义样式表制作 图文并茂 先上效果图 正常样式 拖动时样式 好下面 开始吧 ==================================== ...
- WPF ScrollViewer(滚动条) 自定义样式表制作 (改良+美化)
原文:WPF ScrollViewer(滚动条) 自定义样式表制作 (改良+美化) 注释直接写在代码里了 不太理解意思的 可以先去看看我上一篇 WPF ScrollViewer(滚动条) 自定 ...
- WPF教程十:如何使用Style和Behavior在WPF中规范视觉样式
在使用WPF编写客户端代码时,我们会在VM下解耦业务逻辑,而剩下与功能无关的内容比如动画.视觉效果,布局切换等等在数量和复杂性上都超过了业务代码.而如何更好的简化这些编码,WPF设计人员使用了Styl ...
- WPF下如何使用TTF字体
之前再写代码的时候如果遇到了图标,我都喜欢再资源文件下创建JPG或者PNG来作为图片. 但是随着TTF字体图标的普及,图标类型的的图片越来越多的被放入到TTF中. 这篇也主要是写再WPF下如何使用TT ...
- WPF 中的style 样式
WPF相较于以前学的WinForm,WPF在UI设计与动画方面的炫丽是最吸引我来学习的.在WPF中XMAL代码的引入使得代码的编写能够前后端分离,为获得更好的界面,也使得我们不得不分出一半的时间花在前 ...
- 使用UITableView的分组样式
分组样式顾名思义是对TableView中的数据行进行分组处理,每个分组都有一个header和footer. TableView中header的英文文本是大写的,footer的英文文本是小写的.如下图浅 ...
- WinForm与WPF下跨线程调用控件
Winform下: public delegate void UpadataTextCallBack(string str,TextBox text); public void UpadtaText( ...
随机推荐
- HPE Comware Lab - Simulator
http://h20565.www2.hpe.com/hpsc/swd/public/readIndex?sp4ts.oid=7107838&ac.admitted=1405352934644 ...
- 【u016】无序字母对
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 给定n个各不相同的无序字母对(区分大小写,无序即字母对中的两个字母可以位置颠倒).请构造一个有n+1个 ...
- [CSS Flex] Flex direction
flex-direction: main two 'row' or 'column', you can use reverse also.
- 【t055】成绩统计
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 华南师大附中月考二已经结束,级长想知道最高分是谁.但是现在级长很忙,没有时间统计成绩,于是他找到了你, ...
- Java实现的并发任务处理实例
本文实例讲述了Java实现的并发任务处理方法.分享给大家供大家参考,具体如下: public void init() { super.init(); this.ioThreadPool = new T ...
- XMPP之ios即时通讯客户端开发-mac上搭建openfire服务器(二)
come from:http://www.cnblogs.com/xiaodao/archive/2013/04/05/3000554.html 一.下载并安装openfire 1.到http://w ...
- 80. Domino Internet Password
Internet口令保存在Domino文件夹的个人文档的HTTPPassword域中,和文档中的username一起用于藉各种Internet协议訪问Dominoserver时的校验,最经常使用的就是 ...
- maven hadoop 3.x HADOOP_HOME and hadoop.home.dir are unset Not implemented by the WebHdfsFileSystem FileSystem implementation
具体异常如下: 解决方案: 删除pom文件中的hadoop-core的依赖,原因:hadoop-core是1.x的产物,在2.x之后已经被hadoop-common取代,我配置的时候同时使用了这两个依 ...
- KindEditor4.1.10,支持粘贴图片
转载自https://blog.csdn.net/jimmy0021/article/details/73251406 我已经忘记我是不是从这个博主的那里找到的解决kindeditor粘贴图片的方法了 ...
- setTimeout里的函数是何时进入任务队列里的
先看一段代码 setTimeout(function () { console.log('abc') }, 1000) for (var i = 0; i <= 800000000; i++) ...