The following example demonstrates how to change the background and set a border around spanned cells through a style.
XAML |
Copy Code |
---|---|
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> <Grid.Resources> <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" Source="{Binding Source={x:Static Application.Current}, Path=Orders}" /> <Style x:Key="spannedCellBorderStyle" TargetType="{x:Type Border}"> <Setter Property="Background" Value="LightBlue" /> <Setter Property="BorderBrush" Value="DarkBlue" /> <Setter Property="BorderThickness" Value="1" /> </Style> <Style TargetType="{x:Type xcdg:SpannedCell}"> <Setter Property="CellContainerStyle" Value="{StaticResource spannedCellBorderStyle}" /> </Style> </Grid.Resources> <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource cvs_orders}}"> <xcdg:DataGridControl.View> <xcdg:TableView AllowCellSpanning="True" /> </xcdg:DataGridControl.View> <xcdg:DataGridControl.Columns> <xcdg:Column FieldName="ShipCountry" CellSpanningDirection="Row" /> </xcdg:DataGridControl.Columns> </xcdg:DataGridControl> </Grid> |