SelectionMode="Single"
<DataGridTemplateColumn Header=""> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="更新" Tag="{Binding}"> <Button.Style> <Style x:Name="ButtonVisibility"> <Setter Property="Button.Visibility" Value="Hidden" /> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}, Path=IsSelected}" Value="True"> <Setter Property="Button.Visibility" Value="Visible" /> </DataTrigger> </Style.Triggers> </Style> </Button.Style> </Button> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn>