原文 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分组 样式的更多相关文章

  1. WPF里ItemsControl的分组实现 --listbox 实现分组

    我们在用到ItemsControl时,有时会用到分组,如ListBox,ListView,DataGrid.WPF的ItemsControl可以实现分组,是依托于GroupStyle,以ListBox ...

  2. WPF里ItemsControl的分组实现

    我们在用到ItemsControl时,有时会用到分组,如ListBox,ListView,DataGrid.WPF的ItemsControl可以实现分组,是依托于GroupStyle,以ListBox ...

  3. WPF ScrollViewer(滚动条) 自定义样式表制作 图文并茂

    原文:WPF ScrollViewer(滚动条) 自定义样式表制作 图文并茂 先上效果图 正常样式 拖动时样式 好下面 开始吧 ==================================== ...

  4. WPF ScrollViewer(滚动条) 自定义样式表制作 (改良+美化)

    原文:WPF ScrollViewer(滚动条) 自定义样式表制作 (改良+美化) 注释直接写在代码里了   不太理解意思的 可以先去看看我上一篇  WPF ScrollViewer(滚动条)  自定 ...

  5. WPF教程十:如何使用Style和Behavior在WPF中规范视觉样式

    在使用WPF编写客户端代码时,我们会在VM下解耦业务逻辑,而剩下与功能无关的内容比如动画.视觉效果,布局切换等等在数量和复杂性上都超过了业务代码.而如何更好的简化这些编码,WPF设计人员使用了Styl ...

  6. WPF下如何使用TTF字体

    之前再写代码的时候如果遇到了图标,我都喜欢再资源文件下创建JPG或者PNG来作为图片. 但是随着TTF字体图标的普及,图标类型的的图片越来越多的被放入到TTF中. 这篇也主要是写再WPF下如何使用TT ...

  7. WPF 中的style 样式

    WPF相较于以前学的WinForm,WPF在UI设计与动画方面的炫丽是最吸引我来学习的.在WPF中XMAL代码的引入使得代码的编写能够前后端分离,为获得更好的界面,也使得我们不得不分出一半的时间花在前 ...

  8. 使用UITableView的分组样式

    分组样式顾名思义是对TableView中的数据行进行分组处理,每个分组都有一个header和footer. TableView中header的英文文本是大写的,footer的英文文本是小写的.如下图浅 ...

  9. WinForm与WPF下跨线程调用控件

    Winform下: public delegate void UpadataTextCallBack(string str,TextBox text); public void UpadtaText( ...

随机推荐

  1. 复制相关参数学习笔记--master上的参数

    特别声明: 所有的过滤规则不建议在主库上设置.     server_id 是一个整数,范围:1 至 power(2,32)-1 之间. 推荐使用端口号+ip最后一位的方式. 唯一区别ID,同一个集群 ...

  2. jquery平滑滚动页面

    滚动到顶部 $('.scroll_top').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);}); 滚动到指定位置 ...

  3. 如何使用Name对象,包括WorkspaceNames和DatasetNames

    转自chanyinhelv原文 如何使用Name对象,包括WorkspaceNames和DatasetNames 第一原文链接 该博主还有很多有关arcgis二次开发的不错的文章. 如何使用Name对 ...

  4. [Ramda] Difference between R.converge and R.useWith

    So what is Point-free function. Take a look this example: const getUpdatedPerson = (person) => R. ...

  5. fusionchart实现ZoomLine 资源 破解版 出口能力

    最近的曲线需要用油画ZoomLine官方网站看了好几天,今天整理出来供大家参考使用 zoomline.html资源 <!DOCTYPE HTML PUBLIC "-//W3C//DTD ...

  6. PL/SQL一个简短的引论

    前言 文本 PL/SQL (Procedure Language,程序语言)SQL 1999主要的数据库供应商提供结构化的共同语言  PL/SQL只有支持Oracle数据库 基本的语法 多行凝视   ...

  7. Mapreduce 订单分组案例

    程序执行流程如下: map()-->getPartition()分区--->write()(序列化,每一行都顺序执行这三个方法)--->readFields()---->com ...

  8. 配置ANDROID_HOME

    原文:配置ANDROID_HOME 1.在环境变量中设置一个名为ANDROID_HOME,变量值为SDK路径 2.添加至Path中 备注:ANDROID_HOME的变量值仅允许一个

  9. JSON排序

    //排序之前 var arrs=[{"PageID":"1"},{"PageID":"10"},{"PageI ...

  10. 下面介绍一个 yii2.0 的 Rbac 权限设置,闲话少说,直接上代码,

    1.首先我们要在组件里面配置一下 Rbac ,如下所示(common/config/main-local.php或者main.php).  'authManager' => [  'class' ...