比如要设置GridControl选中单元格的背景颜色以及字体颜色,代码如下:
<Application x:Class="XmlToDT.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys" StartupUri="MainWindow.xaml" Startup="OnAppStartup_UpdateThemeName"> <Application.Resources> <Style x:Key="FocusedCellStyle" TargetType="dxg:LightweightCellEditor" BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle}}"> <Style.Triggers> <Trigger Property="dxg:DataViewBase.IsFocusedCell" Value="True"> <Setter Property="Background" Value="MediumSeaGreen" /> <Setter Property="Foreground" Value="Yellow" /> </Trigger> </Style.Triggers> </Style> </Application.Resources> </Application>