比如要設置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>