• 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>
  • 相关阅读:
    Java字符串的常用方法
    鼠标移小图片大图片改变
    js获得ul li 下的img的src属性
    移动端左右滑动导航
    边框加阴影
    移动端网站根据设计稿动态设置rem
    使用git命令
    HTML返回顶部
    java对象头
    Flutter 实现酷炫的3D效果
  • 原文地址:https://www.cnblogs.com/YunGy/p/6109987.html
Copyright © 2020-2023  润新知