WPF ListView ListBox 常用的样式记录
ListView:
<ListView x:Name="lvBlockedApps"
ItemsSource="{Binding BlockedAppsCollecion}">
<ListView.Style>
<Style TargetType="ListView">
<Setter Property="VerticalAlignment" Value="Top"></Setter>
<Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
<Setter Property="SelectionMode" Value="Single"></Setter> <Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListView}">
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch">
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter> </Style>
</ListView.Style>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Height" Value=""></Setter>
<Setter Property="Margin" Value="5,2,3,0"></Setter>
<Setter Property="BorderBrush" Value="Red"></Setter>
<Setter Property="BorderThickness" Value=""/>
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border x:Name="back" BorderBrush="Green" BorderThickness="" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border Grid.Column="" Width="" Height="" CornerRadius="" Background="#FF83CAD1" Margin="5,0,0,0">
<Border>
<Border.Background>
<ImageBrush ImageSource="{Binding AppIcon,Converter={StaticResource ImgPathToImageConverter}}"></ImageBrush>
</Border.Background>
</Border>
</Border>
<customControl:EnhancedTextBlock Grid.Column="" Margin="10,0,0,0" FontSize="" Text="{Binding Name}" />
<Button Grid.Column=""
x:Name="btnUnblock"
Width="" Height=""
Content="Unblock"
Padding=""
Margin="0,0,8,0"
Style="{DynamicResource FileDialogButtonStyle}"
Click="btnUnblock_Click"></Button>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="back" Property="Background" Value="LightGray"></Setter>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="back" Property="Background" Value="Gray"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter> </Style>
</ListView.ItemContainerStyle>
</ListView>
<ListBox x:Name="lbPageMenus" ItemsSource="{Binding PageMenus}" SelectionMode="Single">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<ItemsPresenter/>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="0,0,50,0"></Setter>
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="IsSelected" Value="{Binding IsSelected}"></Setter>
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="back" BorderBrush="Transparent" BorderThickness="0,0,0,5" Width="{Binding Width}" Height="{Binding Height}">
<TextBlock x:Name="text"
Text="{Binding DisplayName}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize=""
Foreground="White"></TextBlock>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="text" Property="Foreground" Value="#FF47F5F5"></Setter>
<Setter TargetName="back" Property="BorderBrush" Value="#FF47F5F5"></Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="text" Property="Foreground" Value="#FF89D7D4"></Setter>
<Setter TargetName="back" Property="BorderBrush" Value="Transparent"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
WPF ListView ListBox 常用的样式记录的更多相关文章
- WPF ItemsControl ListBox ListView比较
在进行列表信息展示时,WPF中提供多种列表可供选择.这篇博客将对WPF ItemsControl, ListBox, ListView进行比较. 相同点: 1. 这三个控件都是列表型控件,可以进行列表 ...
- WPF - Group分组对ListBox等列表样式的约束
原文:WPF - Group分组对ListBox等列表样式的约束 在做WPF主题支持时,出现一个分组引起的莫名错误,可是折腾了我一番.在没有使用样式时,列表分组很正常,使用了别人写的ListBox列表 ...
- WPF中修改ListBox项的样式病修改选中项的背景颜色
最终效果: 1 <ListBox Name="cmb"> 2 <!--修改颜色--> 3 <ListBox.Resources> 4 <! ...
- 复杂 Listview 显示 多个样式
三种方式 目前为止有三种方法让Listview现实多个样式 最简单最常用的,通过addHeaderView或addFooterView,但是只能在首尾添加 较麻烦但正规的方式,通过getViewTyp ...
- [WPF系列]-ListBox
引言 本文就WPF中的ListBox常用项给以实例代码演示,包括隐蔽属性的设置,Style设置,以及ControlTemplate的自定义. Listbox平滑滚动 <ListBox Ite ...
- [WPF]ListView点击列头排序功能实现
[转] [WPF]ListView点击列头排序功能实现 这是一个非常常见的功能,要求也很简单,在Column Header上显示一个小三角表示表示现在是在哪个Header上的正序还是倒序就可以了. ...
- Android开发工程师文集-Fragment,适配器,轮播图,ScrollView,Gallery 图片浏览器,Android常用布局样式
Android开发工程师文集-Fragment,适配器,轮播图,ScrollView,Gallery 图片浏览器,Android常用布局样式 Fragment FragmentManager frag ...
- WPF中的常用布局 栈的实现 一个关于素数的神奇性质 C# defualt关键字默认值用法 接口通俗理解 C# Json序列化和反序列化 ASP.NET CORE系列【五】webapi整理以及RESTful风格化
WPF中的常用布局 一 写在开头1.1 写在开头微软是一家伟大的公司.评价一门技术的好坏得看具体的需求,没有哪门技术是面面俱到地好,应该抛弃对微软和微软的技术的偏见. 1.2 本文内容本文主要内容 ...
- CSS 常用列表样式
CSS 常用列表样式 CSS没学扎实,复习记录一下.下面是一些常用的属性 list-style-image 指定一个图片作为列表项的标记 默认值none,可设置为图片的url list-style-i ...
随机推荐
- template.js插件和ajax一起使用的例子
template.js 一款 JavaScript 模板引擎,简单,好用.提供一套模板语法,用户可以写一个模板区块,每次根据传入的数据,生成对应数据产生的HTML片段,渲染不同的效果. https:/ ...
- 杭电OJ第11页2000-2009道题(C语言)
1. ASCII码排序 问题描述 输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符 Input: 输入数据有多组,每组占一行,有三个字符组成,之间无空格 Output: 对于每组输入 ...
- TCP-IP 端口号
FTP服务器的TCP端口号 21 Telnet服务器的TCP端口号 23 TETP(简单文件传输协议)服务器的UDP端口号 69 任何TCP/IP实现所提供的服务都用1-1023之间的端口号 至 ...
- while 语句
/* while循环 格式:while(循环保持条件){需要执行的语句} OC: int i = 0; int sum = 0; while (i <= 10) { sum = i++; } w ...
- 一文详解python的类方法,普通方法和静态方法
首先形式上的区别,实例方法隐含的参数为类实例self,而类方法隐含的参数为类本身cls. 静态方法无隐含参数,主要为了类实例也可以直接调用静态方法. 所以逻辑上,类方法被类调用,实例方法被实例调用,静 ...
- 12、xamarin form中实现H5 网页唤醒微信支付的方法
在微信的支付中有种支付叫微信H5支付.方便用户在网页中轻松唤起微信进行支付. 当然微信不推荐大家使用这样的方式唤起微信支付.建议app还是使用正常的微信支付sdk即可 服务端与其他的建议参考微信支付官 ...
- Apache版本hadoop-2.6.0.tar.gz平台下搭建Hue
不多说,直接上干货! http://archive.apache.org/dist/ http://www.cnblogs.com/smartloli/p/4527168.html http://ww ...
- Python -- 图片处理
使用PIL库 转换图片格式(jpg --> png) from PIL import Image Image.open('E:/art.jpg').save('E:/art.png')
- ubuntu 16.04 安装PhpMyAdmin
首先,安装mysql $ sudo apt-get install mysql-server $ sudo apt-get install mysql-client 安装时输出root用户的密码 然后 ...
- Docker容器打包成镜像 - OpenDaylight官方 SDN Hub Tutorial VM 的docker镜像
由于工作需要,在看OpenDaylight (一个SDN的开源控制器) 官方Tutorial有一个比较基础且介绍比较详细的文档(http://sdnhub.org/tutorials/opendayl ...