当我尝试打开屏幕时,出现以下异常:
无法将“System.Windows.Controls.Grid”类型的对象转换为“System.Windows.Controls.TabItem”类型
任何帮助将不胜感激。
partial void VouchersDetail_Created()
{
this.FindControl("JournalVoucher").ControlAvailable += JournalVoucher_ControlAvailable;
}
void JournalVoucher_ControlAvailable(object sender, ControlAvailableEventArgs e)
{
((System.Windows.Controls.TabItem)e.Control).KeyUp += JournalVoucher_KeyUp;
}
void JournalVoucher_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.V)
{
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
{
var tabitem = (System.Windows.Controls.TabItem)sender;
tabitem.IsEnabled = true;
}
}
}
谢谢