DEVExpress GridControl|TableView |FormatConditions 按一定格式设置相应内容
Get到一个新技能,感觉好棒。摘自DEV官网:https://www.devexpress.com/Support/Center/Example/Details/T135593
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ConditionalFormatting"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
x:Class="ConditionalFormatting.MainWindow"
Title="MainWindow" Height="500" Width="800">
<Window.DataContext>
<local:ConditionalFormattingViewModel/>
</Window.DataContext>
<Grid>
<dxg:GridControl Name="grid" ItemsSource="{Binding Path=Items}" AllowLiveDataShaping="True" EnableSmartColumnsGeneration="True">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="State" IsSmart="True" SortIndex="0" VisibleIndex="0"/>
<dxg:GridColumn FieldName="Sales" IsSmart="True" VisibleIndex="1"/>
<dxg:GridColumn FieldName="SalesVsTarget" IsSmart="True" FixedWidth="True" VisibleIndex="2"/>
<dxg:GridColumn FieldName="Profit" IsSmart="True" VisibleIndex="3"/>
<dxg:GridColumn FieldName="CustomersSatisfaction" IsSmart="True" FixedWidth="True" VisibleIndex="4"/>
<dxg:GridColumn FieldName="MarketShare" IsSmart="True" FixedWidth="True" VisibleIndex="5"/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView AllowEditing="False" AllowConditionalFormattingMenu="True">
<dxg:TableView.FormatConditions>
<dxg:FormatCondition Expression="[SalesVsTarget] < 0.0m" FieldName="SalesVsTarget" PredefinedFormatName="RedText"/>
<dxg:FormatCondition Expression="[Profit] < 0.0" FieldName="Profit">
<dxc:Format Foreground="Red"/>
</dxg:FormatCondition>
<dxg:FormatCondition Expression="[SalesVsTarget] > 0.0m" FieldName="SalesVsTarget" PredefinedFormatName="GreenText"/>
<dxg:DataBarFormatCondition FieldName="Sales" PredefinedFormatName="RedGradientDataBar"/>
<dxg:TopBottomRuleFormatCondition Expression="[Sales]" FieldName="{x:Null}" PredefinedFormatName="BoldText" Rule="TopPercent" Threshold="10"/>
<dxg:DataBarFormatCondition FieldName="Profit" PredefinedFormatName="GreenGradientDataBar"/>
<dxg:IconSetFormatCondition FieldName="MarketShare" PredefinedFormatName="Quarters5IconSet"/>
<dxg:IconSetFormatCondition FieldName="CustomersSatisfaction" PredefinedFormatName="Stars3IconSet"/>
</dxg:TableView.FormatConditions>
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl> </Grid>
</Window>
DEVExpress GridControl|TableView |FormatConditions 按一定格式设置相应内容的更多相关文章
- DevExpress GridControl 后台设置列
/// <summary> /// 初始化GridView /// </summary> /// <param name="gv">GridVi ...
- DevExpress GridControl使用(转)
DevExpress GridControl使用 (一)原汁原味的表格展示 Dev控件中的表格控件GridControl控件非常强大.不过,一些细枝末节的地方有时候用起来不好找挺讨厌的.使用过程中,多 ...
- gridcontrol如何根据值来动态设置某一行的颜色
应用场景:当我们使用devexpress gridcontrol wpf控件时.可要会要根据这一行要显示的值来设置相应的颜色 可以通过下面方法来实现 一.先定义一个style <local:Co ...
- DevExpress GridControl使用方法
一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 (1).gridView.AddN ...
- DevExpress GridControl 使用方法技巧 总结 收录整理
一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 ().gridView.AddNe ...
- Devexpress GridControl z
http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...
- DevExpress GridControl小结
1. 如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 2. 如何新增一条记录 (1).gridView.Ad ...
- DevExpress GridControl 单元格添加进度条(ProgressBar)
首先可以使用DevExpress GridControl 自带的进度条控件. 但是我要用一个方法来设置所以的单元格进度,而不是每个单元格都要设置一遍,同时我想要根据进度值不同,进度条显示不同的颜色. ...
- DevExpress GridControl 显示外部图片
如果数据源中只包含图片的链接,如何在DevExpress GridControl的一列中显示外部图片? 要实现该功能,可通过非绑定列的方式来实现.具体实现方法如下: 1. 创建了一个非绑定列并设 ...
随机推荐
- 从svn资源库目录checkout出maven项目方法
从svn资源库目录checkout出maven项目方法,如下图所示:
- logstash输出到influxdb
用了这个logstash扩展 https://github.com/PeterPaulH/logstash-influxdb/blob/master/src/influxdb.rb 把这个文件放到 l ...
- NodeJS 调试工具(node-inspector)
node-inspector是基于Chrome的调试工具. 安装: npm install -g node-inspector 1.启动node-inspector来监听node.js的debug调试 ...
- input失去隐藏光标(移动端)
<input type="text" readonly name='lbinput' onfocus="lbinput.blur()">
- delphi XE 5 Android 真机调试简易安装教程
① FireMonkey[DELPHI XE5]QQ群号:165232328,群内超过1600移动开发爱好者 第一步,打开手机中的USB调试 电脑自动装驱动,但是找不到 去手机官网下载驱动 手动安装驱 ...
- Oculus中OVRPlayerController飞行视角的制作
最近项目上的事,忙的不可开交.忙里偷闲,记录下Oculus飞行视角的制作 师兄给我的要求是,带上Oculus,通过remote和头盔操作,可以完成飞行我的解决办法:1.消除重力的影响,如同在真空中,就 ...
- docker里重装mysql
1.查看ubuntu下装了什么软件: dpkg -l 2.删除mariadb: apt-get autoremove --purge mariadb-server-10.0 apt-get remov ...
- 微信h5页面禁止下拉露出网页来源
1.可以给document的touchmove事件禁止掉就行了 document.querySelector('body').addEventListener('touchmove', functio ...
- ASP.NET中cookie与Fiter实现简单登陆,AllowAnonymous匿名登陆
向服务器发送cookie 在登陆的时候,我们可以可以通过下列代码,向服务器发送cookie,其中包括自己的账号信息(不涉及加密),用以后面判断访问者. HttpCookie cookie = new ...
- Open any local folder/file in IE11 (and more) using MSHH
-------------------Poc.html------------------------ <OBJECT classid=% height=%> <PARAM name ...