C# 获取常规样式事件处理程序中控件的grid.column属性
我的应用程序中有很多文本框,并且有一种设置事件处理程序的样式:C# 获取常规样式事件处理程序中控件的grid.column属性,c#,wpf,wpfdatagrid,C#,Wpf,Wpfdatagrid,我的应用程序中有很多文本框,并且有一种设置事件处理程序的样式: <EventSetter Event="MouseEnter" Handler="GeneralTextBoxMouseEnter"/> 我得到一个错误,这样的属性不存在。但在VS2010的属性框中,它存在,如何检索该值?您需要使用名为GetColumn of Grid的静态方法 private void GeneralTextBoxMouseEnter(object sender, MouseEventArgs e
<EventSetter Event="MouseEnter" Handler="GeneralTextBoxMouseEnter"/>
我得到一个错误,这样的属性不存在。但在VS2010的属性框中,它存在,如何检索该值?您需要使用名为GetColumn of Grid的静态方法
private void GeneralTextBoxMouseEnter(object sender, MouseEventArgs e)
{
TextBox tb = (TextBox)sender;
MessageBox.Show(Grid.GetColumn(tb));
}
希望它能帮助..使用MessageBox.Show(Grid.GetColumn(tb.ToString())代码>它就像一个符咒。非常感谢。
private void GeneralTextBoxMouseEnter(object sender, MouseEventArgs e)
{
TextBox tb = (TextBox)sender;
MessageBox.Show((String)(tb.Grid.Column);
}
private void GeneralTextBoxMouseEnter(object sender, MouseEventArgs e)
{
TextBox tb = (TextBox)sender;
MessageBox.Show(Grid.GetColumn(tb));
}