8,737
社区成员
发帖
与我相关
我的任务
分享
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Border x:Name="border" Visibility="{Binding Item.C3.visibility}" Style="{StaticResource boderStyle}" >
<Grid x:Name="gdContent" Margin="3" >
<TextBlock Foreground="Black" Text="{Binding Item.C3.productname}" Background="{Binding Item.C3.backgroud}" ToolTip="{Binding Item.C3.productname}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<i:InvokeCommandAction CommandParameter="{Binding Item.C3.spaceCellInfo}" Command="{Binding DataContext.DetailCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBlock>
</Grid>
</Border>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
思路大概是:设置datagrid数据模板,点击模板里的控件时改变控件外围的border背景样式,取消点击时样式恢复