【发布时间】:2015-09-29 14:01:32
【问题描述】:
我有带有隐藏按钮的数据网格,如何在使用 Style.Triggers 选择行后使行中的按钮可见?
<Grid>
<DataGrid ItemsSource="{Binding Items}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header="" Width="15" MinWidth="15" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Margin="0" Background="Gray">
<Button x:Name="CurrentButton" Content="{Binding number}" Visibility="Hidden"></Button>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
【问题讨论】: