我有一个列,其中有一个用于编辑该行的按钮,但id键不是唯一的值,而是三个值。如何设置按钮中的三个值,以便在单击按钮时,可以在后面的代码中获得三个值?
栏目
<dg:DataGridTemplateColumn Header="Edit">
<dg:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Adjust" DataContext="{Binding wId1}" Click="EditButton_Click" />
</DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
</dg:DataGridTemplateColumn>我想通过wId1,wId2,wId3。此外,还可以使用字符串值wId1+wId2+wId3传递一个值?
请给我任何阅读这方面的建议,非常感谢。
发布于 2009-12-05 12:31:20
您可以绑定到任何公共属性,因此一种选择可能是拥有一个只返回连接字符串的属性?大致是这样的:
public string ConcatenatedValues
{
get
{
return wId1 + wId2 + wId3;
}
}然后绑定到它上。如果有一种更优雅的方式会很有趣,但这应该可以完成工作。
https://stackoverflow.com/questions/1851123
复制相似问题