【发布时间】:2012-05-13 21:34:43
【问题描述】:
我有一个 DataGrid 定义如下。当我单击 DataGrid 中的一个单元格时,仅突出显示该单元格。如何更改它,以便在单击单元格时突出显示整行?
<DataGrid Name="fileGrid" AutoGenerateColumns="False" Height="150" Width="Auto"
Margin="10,10,0,0"
HorizontalAlignment="Left" VerticalAlignment="Top" SelectionChanged="fileGrid_SelectionChanged">
<DataGrid.Columns>
<DataGridTextColumn Header="Company Name"
x:Name="columnCompanyName"
Binding="{Binding Path=Customer.CompanyName}"
IsReadOnly="True">
</DataGridTextColumn>
<DataGridTextColumn Header="Customer Surname"
x:Name="columnCustomerSurname"
Binding="{Binding Path=Customer.Surname}"
IsReadOnly="True">
</DataGridTextColumn>
<DataGridTextColumn Header="Customer Address"
x:Name="columnAddressLine1"
Binding="{Binding Path=Customer.Address.Line1}"
IsReadOnly="True">
</DataGridTextColumn>
<DataGridTextColumn Header="Customer City"
x:Name="columnCity"
Binding="{Binding Path=Customer.Address.City}"
IsReadOnly="True">
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
【问题讨论】:
-
我尝试寻找与 Cell 关联的 Row 属性,但没有。我能找到的只是列属性。