zoukankan      html  css  js  c++  java
  • DevExpress WPF使用指南

    下载DevExpress v20.2完整版

    DevExpress WPF Subscription(曾命名DevExpress WPF Controls)拥有120+个控件和库,将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpress WPF能创建有着强大互动功能的XAML基础应用程序,这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。 无论是Office办公软件的衍伸产品,还是以数据为中心的商业智能产品,都能通过DevExpress WPF控件来实现。

    问题

    已经在GridControl中更改了选定的行背景、前景和fontweight,效果很好。 但是当GridControl失去焦点时,选定的行样式也会更改,如何防止或者覆盖?

    XAML

    <dxg:GridControl.View>
    <dxg:TableView x:Name="productionElementsView" UseLightweightTemplates="None" MultiSelectMode="Row" NavigationStyle="Row" ShowGroupPanel="True" FilterEditorCreated="TableView_FilterEditorCreated" PreviewMouseLeftButtonDown="productionElementsView_PreviewMouseLeftButtonDown" >
    <dxg:TableView.RowStyle>
    <Style TargetType="{x:Type dxg:GridRowContent}" BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle, IsThemeIndependent=True}}">
    <Setter Property="Background" Value="{Binding Path=Row, Converter={StaticResource ResourceKey=ItemTypeBackgroundColor}}" />
    <Setter Property="Foreground" Value="{Binding Path=Row, Converter={StaticResource ResourceKey=ItemTypeForegroundColor}}" />
    <Setter Property="FontWeight" Value="Regular" />
    <Style.Triggers>
    <Trigger Property="dxg:DataViewBase.IsFocusedRow" Value="True">
    <Setter Property="Background" Value="#FFFFDC00" />
    <Setter Property="Foreground" Value="Black" />
    <Setter Property="FontWeight" Value="SemiBold" />
    
    </Trigger>
    <DataTrigger Binding="{Binding IsSelected}" Value="True">
    <Setter Property="Background" Value="#FFFFDC00" />
    <Setter Property="Foreground" Value="Black" />
    <Setter Property="FontWeight" Value="SemiBold" />
    </DataTrigger>
    </Style.Triggers>
    </Style>
    </dxg:TableView.RowStyle>
    </dxg:TableView>
    </dxg:GridControl.View>
    解决方案

    您可以将TableView的FadeSelectionOnLostFocus设置为false,以对焦点/选定行使用相同的颜色。

    要为这种情况定义颜色,可以使用TableView的RowStyle属性并为RowControl的FadeSelection属性创建触发器:

    XAML

    <dxg:TableView.RowStyle>
    <Style TargetType="dxg:RowControl">
    <Style.Triggers>
    <Trigger Property="FadeSelection" Value="True">
    <Setter Property="Background" Value="Red"/>
    </Trigger>
    </Style.Triggers>
    </Style>
    </dxg:TableView.RowStyle>

    上DevExpress中文网,获取第一手最新产品资讯!

    DevExpress技术交流群3:700924826      欢迎一起进群讨论

  • 相关阅读:
    洛谷P2330: [SCOI2005]繁忙的都市(最小生成树)
    洛谷P1019: 单词接龙(dfs)
    洛谷P1019: 单词接龙(dfs)
    hdu1598:find the most comfortable road(并查集)
    hdu1598:find the most comfortable road(并查集)
    洛谷P1616 :疯狂的采药(完全背包)
    洛谷P1616 :疯狂的采药(完全背包)
    洛谷P1119: 灾后重建(最短路)
    洛谷P1119: 灾后重建(最短路)
    1008 N的阶乘 mod P(51NOD基础题)
  • 原文地址:https://www.cnblogs.com/AABBbaby/p/14306311.html
Copyright © 2011-2022 走看看