当我尝试将行设置为用户选择的行时,我在标题中声明了该错误。此行发生错误:
DataGridRow row = e.Row as DataGridRow;
错误消息:无法转换类型 ' ExtendedGrid.Microsoft.Windows.Controls.DataGridRow'至 ' System.Windows.Controls.DataGridRow'通过参考转换, 装箱转换,拆箱转换,换行或转换 类型转换
我正在使用WPF Extended DataGrid。这是RowDetailsVisibilityChanged事件的源代码:
private void RowDetailsVisibilityChanged(object sender, ExtendedGrid.Microsoft.Windows.Controls.DataGridRowDetailsEventArgs e)
{
DataGridRow row = e.Row as DataGridRow;
FrameworkElement tb = GetTemplateChildByName(row, "RowHeaderToggleButton");
if (tb != null)
{
if (row.DetailsVisibility == System.Windows.Visibility.Visible)
{
(tb as ToggleButton).IsChecked = true;
}
else
{
(tb as ToggleButton).IsChecked = false;
}
}
}
有关错误的建议吗?