0
如果活動單元格的類型爲double或int,我試圖提供所選行的快速總結。如果網格沒有按任何列進行分組,此工作正常。但是,當網格按一列或多列分組時,在選擇頂級行時沒有活動單元格。UltraWinGrid - 按行獲取當前單元格/列
void ultraGrid_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
var ultraGrid = ((UltraGrid)sender);
var selected = ultraGrid.Selected;
var hasCells = selected.Cells != null && selected.Cells.Count > 0;
var hasRows = selected.Rows != null && selected.Rows.Count > 0;
if (!hasCells && !hasRows)
{
statusLabel.Text = string.Empty;
return;
}
UltraGridColumn activeColumn;
var activeCell = ultraGrid.ActiveCell;
if(activeCell == null )
{
var aUIElement = ultraGrid.DisplayLayout.UIElement.ElementFromPoint(ultraGrid.PointToClient(MousePosition));
activeColumn = (UltraGridColumn)aUIElement.GetContext(typeof(UltraGridColumn));
}
else activeColumn = activeCell.Column;
if(activeColumn == null || (activeColumn.DataType != typeof (double) && activeColumn.DataType != typeof (int)))
{
statusLabel.Text = string.Empty;
return;
}
//code to calculate summaries for selected rows or cells and active column
}
但aUIElement.GetContext(typeof運算(UltraGridColumn))選擇按行組時總是返回null。 當按行按組選擇時,如何獲得活動列/單元格?
感謝羅布。我試圖在不添加編輯文本的情況下進行編輯,但它說我必須添加6個非空格字符才能完成編輯。 – 2011-05-20 15:02:36