WPat datagrid style

If the data table has only 1-2 records and it has some height for at least 10 rows. It shows an empty background and looks ugly, is there a way to show empty lines or any other sentence?

+4
source share
2 answers

Of course, you can show a translucent / transparent background if you want ...

<Style x:Key="Global_DataGrid" TargetType="{x:Type dg:DataGrid}"> <Setter Property="Background"> <Setter.Value> <SolidColorBrush Color="White" Opacity="0.6" /> </Setter.Value> </Setter> </Style> 

We keep the good background image behind, so the partially opaque background on the unused space looks good, although, nevertheless, it is obvious that this shielding of the property should contain more lines in the grid.

+2
source

The following will work:

 <DataGrid.CellStyle> <Style TargetType="DataGridCell"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="White" /> <Setter Property="Foreground" Value="Black" /> </Trigger> </Style.Triggers> </Style> </DataGrid.CellStyle> <DataGrid.RowStyle> <Style TargetType="DataGridRow"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="BorderBrush" Value="Blue" /> <Setter Property="BorderThickness" Value="2" /> </Trigger> </Style.Triggers> </Style> </DataGrid.RowStyle> 
0
source

Source: https://habr.com/ru/post/1332956/


All Articles