I have a DataGrid looking like this:
<DataGrid
AutoGenerateColumns="False"
EnableColumnVirtualization="True"
EnableRowVirtualization="True"
GridLinesVisibility="Horizontal"
IsReadOnly="False"
ItemsSource="{Binding EmployeesCollectionView}"
KeyboardNavigation.TabNavigation="Once"
SelectionMode="Extended"
SelectionUnit="FullRow"
VirtualizingPanel.VirtualizationMode="Recycling">
//...
</DataGrid>
It is bound to an ObservableCollection.
The columns' style:
<Style x:Key="ColumnStyle" TargetType="DataGridCell">
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Foreground" Value="Black" />
</Style>
This is how the row looks upon selecting it:
The only way to select it is to click on any of the cells (only where there is text) and both the cells and the row get highlighted.
I want to be able to click anywhere on the row, not only where there is the text, and to not have all the cells highlighted in this (respectfully) ugly way.
I am most likely missing something very trivial, but what is it exactly?
I have tried setting HorizontalContentAlignment instead of HorizontalAlignment and VerticalContentAlignment instead of VerticalAlignment as suggested in many places and the selection looks okay, but the text is positioned in the upper left corner, which is not my intention.
