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>
  • 相关阅读:
    开启power management功能有坑,ESP32串口频繁出现UART_BREAK中断
    ESP32音频开发板ESP32-Korvo V1.1踩坑
    驱动开发常用位运算
    ESP8266 RTOS 开发笔记(4)串口透传
    mosquitto服务状态监控(转载)
    ESP8266 RTOS 开发笔记(3)用户参数
    ESP8266 RTOS 开发笔记(2)TCP Client+Server
    ESP8266 RTOS 开发笔记(1)STA+AP模式(共存)
    C uint32 转 uint8
    python 简易计算器(只能计算加减乘除和括号)
  • 原文地址:https://www.cnblogs.com/YunGy/p/6109987.html
Copyright © 2011-2022 走看看