zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    001-docker-net-网络设置分类、Bridge详解、mac docker说明
    010-Linux 磁盘信息查看
    011-Spring aop 002-核心说明-切点PointCut、通知Advice、切面Advisor
    【高并发】Akka 模型
    【大数据】Spark On Yarn
    【Git】git pull和git pull --rebase的使用
    【Zookeeper】连接ZooKeeper的方式
    【Cloud】IaaS、PaaS和SaaS
    【Linux】解决"no member named 'max_align_t'
    【神经网络】Dependency Parsing的两种解决方案
  • 原文地址:https://www.cnblogs.com/YunGy/p/6109987.html
Copyright © 2011-2022 走看看