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( ...
随机推荐
- php实现表示数值的字符串(is_numeric($s))
php实现表示数值的字符串(is_numeric($s)) 一.总结 is_numeric($s) 二.php实现表示数值的字符串 题目描述 请实现一个函数用来判断字符串是否表示数值(包括整数和小数) ...
- [Grid Layout] Place grid items on a grid using grid-column and grid-row
It’s possible to position a grid item anywhere on a grid track. To do this, let’s specify some grid- ...
- EM12C 安装及卸载 注意点整理
版本号: em12c 12.1.0.4 OS : redhat 5.7 x86_64bit (CentOS6.2,測试过,当时因glibc*.i686包安装一直报错.所以放弃了) ...
- [Javascript] Identify and Deal with NaN in JavaScript
Dealing with the special NaN value can be tricky in JavaScript. It behaves like a number and not a n ...
- js进阶-9-3/4 form对象有哪些常用属性
js进阶-9-3/4 form对象有哪些常用属性 一.总结 一句话总结: 1.一般html标签有哪些常用属性:name id value 2.form对象有哪些常用属性(特有):action meth ...
- mingw-w64线程模型:posix vs win32(posix允许使用c++11的std:: thread,但要带一个winpthreads,可能需要额外dll)
我正在安装 mingw-w64 on Windows,有两个选项: win32线程和posix线程. 我知道win32线程和pthreads之间的区别,但是我不明白这两个选项之间的区别. 我怀疑如果我 ...
- 使用HAXM为QEMU for Windows加速
QEMU是一款支持多种CPU的虚拟化软件,本身基于软件虚拟化,效率不高,在linux下可以基于KVM加速,据说可以获得接近物理机的性能.网上有很多关于QEMU+KVM的使用说明,但是KVM仅用于lin ...
- ik_max_word ik_smart
打开 ~/es_root/config/elasticsearch.yml 文件,加入以下配置: index: analysis: analyzer: ik_syno: type: custom to ...
- Spring实战5-基于Spring构建Web应用
主要内容 将web请求映射到Spring控制器 绑定form参数 验证表单提交的参数 写在前面:关于Java Web,首先推荐一篇文章——写给java web一年左右工作经验的人,这篇文章的作者用精练 ...
- jQuery中对象的构建
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...