I have an ultragrid with lots of rows, new rows are added to the end, I want that when a new row is added, that row is selected and the grid also should scroll to the bottom.
I was going to try ActiveRow but it says it has no setter
private void ultraButtonCreateNew_Click(object sender, EventArgs e)
{
DialogResult dr = new DialogResult();
FormAddUnit form = new FormAddUnit();
form.BuildingDataSet = _buildingDataSet;
form.SectionDataSet = _sectionDataSet;
form.UnitDataSet = _uc011_WizardStepUnitDataSet;
form.SummaryDataSet = _summaryDataSet;
form.FormState = WizardState.Create;
form.Enablement = false;
dr = form.ShowDialog();
if (dr == DialogResult.Yes)
{
UC011_WizardStepUnitDataSet.UnitRow row = form.GetRow();
_uc011_WizardStepUnitDataSet.Unit.AddUnitRow(row);
SetUltraGridData();
ultraGridOverview.DisplayLayout.ActiveRow = row;
SetSummaryDataSet();
}
}
In order to select a row and scroll it into the view, you can either call the Activate Method on a row like this
ultraGridOverview.Rows[ultraGridOverview.Rows.Count - 1].Activate()
or you can set the Position Property of the underlying CurrencyManager
CurrencyManager currencymanagerCustomers;
currencymanagerCustomers = this.BindingContext(ultraGridOverview.DataSource);
currencymanagerCustomers.Position = _uc011_WizardStepUnitDataSet.Rows.Count -1;