■ TableView 클래스의 RowStyle 속성을 사용해 데이터 행에 적용되는 스타일을 설정하는 방법을 보여준다.
▶ 예제 코드 (XAML)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<Window x:Class="HowToChangeTheAppearanceOfSelectedRows.MainWindow" 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" Width="600" Height="450" Title="Change The Appearance Of Selected Rows"> <Window.Resources> <Style x:Key="SelectedRowStyleKey" TargetType="{x:Type dxg:GridRowContent}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsSelected}" Value="True"> <Setter Property="Background" Value="Gray" /> <Setter Property="Foreground" Value="White" /> </DataTrigger> <Trigger Property="dxg:GridViewBase.IsFocusedRow" Value="True"> <Setter Property="Background" Value="Red" /> <Setter Property="Foreground" Value="White" /> </Trigger> </Style.Triggers> </Style> </Window.Resources> <Grid> <dxg:GridControl x:Name="gridControl" AutoGenerateColumns="AddNew" SelectionMode="Row"> <dxg:GridControl.View> <dxg:TableView ShowGroupPanel="False" AllowGrouping="False" RowStyle="{StaticResource SelectedRowStyleKey}" /> </dxg:GridControl.View> </dxg:GridControl> </Grid> </Window> |