Im使用Infragistics4.Win.UltraWinGrid.v16.1數據容器。比方說,我剛剛更新了DataSource,並且希望將該行(它在DataSource更新時顯示)激活,因爲它會滾動到該行並將其選中。目前,我有以下錯誤的實現:Infragistics UltraWinGrid選擇新添加的行
private void SelectByID(int searchId)
{
ISelectionManager selectionManager = grdProjects;
foreach (UltraGridRow row in grdProjects.Rows)
{
if (Convert.ToInt32(row.Cells["StagingID"].Value) == searchId)
{
selectionManager.ActivateItem(row);
row.Activate();
if (grdProjects.ActiveRowScrollRegion.IsActiveScrollRegion)
grdProjects.ActiveRowScrollRegion.ScrollRowIntoView(row);
break;
}
}
}
private void _createProjectDialog_FormClosed(object sender, FormClosedEventArgs e)
{
CreateProjectDialog send = (CreateProjectDialog)sender;
if (send.SetAsCurrent)
{
this.Close();
}
else
{
//refresh grid and set current proj
_stagingProjects.Add(send.StagingProject);
grdProjects.Rows.Refresh(RefreshRow.ReloadData);
SelectedProject = ApplicationContext.Instance.Project.StagingProject;
SelectByID(SelectedProject.StagingID);
}
}
注意我添加的兩行代碼:
row.Activate();
if(grdProjects.ActiveRowScrollRegion.IsActiveScrollRegion)
的IsActiveScrollRegion
條件通過,但該行仍沒有在網後選擇執行。
謝謝你的幫助!
注意預期始終排在電網,未選中的底結束。 – Rice