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 按一定格式设置相应内容的更多相关文章

  1. DevExpress GridControl 后台设置列

    /// <summary> /// 初始化GridView /// </summary> /// <param name="gv">GridVi ...

  2. DevExpress GridControl使用(转)

    DevExpress GridControl使用 (一)原汁原味的表格展示 Dev控件中的表格控件GridControl控件非常强大.不过,一些细枝末节的地方有时候用起来不好找挺讨厌的.使用过程中,多 ...

  3. gridcontrol如何根据值来动态设置某一行的颜色

    应用场景:当我们使用devexpress gridcontrol wpf控件时.可要会要根据这一行要显示的值来设置相应的颜色 可以通过下面方法来实现 一.先定义一个style <local:Co ...

  4. DevExpress GridControl使用方法

    一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 (1).gridView.AddN ...

  5. DevExpress GridControl 使用方法技巧 总结 收录整理

    一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 ().gridView.AddNe ...

  6. Devexpress GridControl z

    http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...

  7. DevExpress GridControl小结

    1. 如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 2. 如何新增一条记录 (1).gridView.Ad ...

  8. DevExpress GridControl 单元格添加进度条(ProgressBar)

    首先可以使用DevExpress GridControl 自带的进度条控件. 但是我要用一个方法来设置所以的单元格进度,而不是每个单元格都要设置一遍,同时我想要根据进度值不同,进度条显示不同的颜色. ...

  9. DevExpress GridControl 显示外部图片

    如果数据源中只包含图片的链接,如何在DevExpress GridControl的一列中显示外部图片? 要实现该功能,可通过非绑定列的方式来实现.具体实现方法如下: 1.    创建了一个非绑定列并设 ...

随机推荐

  1. Lucene.net

    模糊查询-〉数据库全文检索-〉Lucene 一元分词(lucene内置) Analyzer analyzer = new CJKAnalyzer(); TokenStream tokenStream ...

  2. ps一些图片的操作

    ctrl+c 复制 ctrl+n 新建 ctrl+v粘贴 ctrl+s 保存 如果要将某个带字的背景去掉它的字体那么就是 ctrl+t

  3. ebs history to look for password

    -bash-3.2$ ps -ef|grep tns root 101 2 0 Jun01 ? 00:00:00 [netns] oravibs 10625 1 0 Sep09 ? 00:01:03 ...

  4. kafka0.9.0及0.10.0配置属性

    问题导读1.borker包含哪些属性?2.Producer包含哪些属性?3.Consumer如何配置?borker(0.9.0及0.10.0)配置Kafka日志本身是由多个日志段组成(log segm ...

  5. IOS 截取图片 部分 并生成新图片

    /** * 从图片中按指定的位置大小截取图片的一部分 * * @param image UIImage image 原始的图片 * @param rect CGRect rect 要截取的区域 * * ...

  6. wf(六)

    前面我们都是通过WorkflowInvoker这个类来调用方法的,这种方式是很简单的,因为这是同步的而且同样的调用者调用工作流使用的线程是一样的. 另外一个调用工作流的方法是通过工作流应用程序类(Wo ...

  7. PHPCMS企业站制作

    安装 将下载好的文件放到www目录下 地址栏中输入 http://localhost:8080/phpcms/install_package/install 打开安装页面 进行安装即可. 如果出现: ...

  8. Spring MVC控制器

    Spring MVC中控制器用于解析用户请求并且转换为模型以提供访问应用程序的行为,通常用注解方式实现. org.springframework.stereotype.Controller注解用于声明 ...

  9. 《.Net 的冰与火之歌》寄雁传书,你必须知道的C#参数知识大盘点

    引言 参数,也叫参变量,是一个变量.在方法签名中随处可见,实现了不同方法间对于数据的寄雁传书,基本上充斥在代码的各个角落里.在方法签名或者原型中,方法名称后的括号包含方法的参数及其类型的完整列表.参数 ...

  10. selenium之js

    通过调用js代码来网页的滚动条: 出现以上错误的原因是 driver.set_window_size(600,600) 放置的位置不对