public virtual bool EnsureRowVisible(GridViewRowInfo rowInfo) { if (rowInfo.ViewInfo != this.ViewInfo || rowInfo.ViewInfo == this.MasterViewInfo && rowInfo.PinPosition != PinnedRowPosition.None || (!this.TableElement.ElementTree.Control.Visible && !(this.TableElement.ElementTree.Control is MultiColumnComboGridView) || (this.TableElement.ElementTree.Control.Size == Size.Empty || (SizeF)this.TableElement.Size == SizeF.Empty))) { return(false); } if (this.TableElement.MasterTemplate != null && this.TableElement.MasterTemplate.EnablePaging) { int pageIndex = this.TableElement.MasterTemplate.PageIndex; if (this.TableElement.MasterTemplate.EnableGrouping && this.TableElement.MasterTemplate.GroupDescriptors.Count > 0) { int num = -2; IEnumerator enumerator = (IEnumerator) new PagedGroupedTraverser(((RadDataView <GridViewRowInfo>) this.TableElement.MasterTemplate.DataView).GroupBuilder.Groups.GroupList); while (enumerator.MoveNext()) { GridViewGroupRowInfo current = enumerator.Current as GridViewGroupRowInfo; if (current != null && current.GroupLevel == 0) { ++num; } if (enumerator.Current == rowInfo) { break; } } if (num >= 0) { pageIndex = num / this.TableElement.MasterTemplate.PageSize; } } else { pageIndex = this.TableElement.ViewTemplate.DataView.GetItemPage(rowInfo); } if (pageIndex != this.TableElement.MasterTemplate.PageIndex && !(rowInfo is GridViewNewRowInfo)) { this.TableElement.MasterTemplate.MoveToPage(pageIndex); this.TableElement.ViewElement.UpdateRows(true); if (this.TableElement.GridViewElement != null) { this.GridViewElement.PagingPanelElement.UpdateView(); } } } this.UpdateLayout(); GridViewDetailsRowInfo viewDetailsRowInfo = rowInfo as GridViewDetailsRowInfo; if (viewDetailsRowInfo == null) { return(this.EnsureRowVisibleCore(rowInfo)); } RadScrollBarElement vScrollBar = this.UseScrollbarsInHierarchy ? this.VScrollBar : this.MasterVScrollBar; if (this.GetRowElement((GridViewRowInfo)viewDetailsRowInfo) is GridDetailViewRowElement || !this.EnsureRowVisibleByTraverser(vScrollBar, (GridViewRowInfo)viewDetailsRowInfo, (float)vScrollBar.SmallChange)) { return(false); } this.UpdateLayout(); return(true); }
protected override void OnPropertyChanged(PropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (!(e.PropertyName == "PinPosition")) { return; } GridViewGroupRowInfo parent = this.Parent as GridViewGroupRowInfo; if (parent == null) { return; } bool flag = true; foreach (GridViewRowInfo childRow in parent.ChildRows) { if (childRow.PinPosition == PinnedRowPosition.None) { flag = false; break; } } this.IsVisible = !flag; }
public virtual object Evaluate(IHierarchicalRow row) { string summaryExpression = this.GetSummaryExpression(); if (string.IsNullOrEmpty(summaryExpression)) { return((object)null); } object obj = (object)null; GridViewGroupRowInfo viewGroupRowInfo = row as GridViewGroupRowInfo; if (viewGroupRowInfo != null) { return(viewGroupRowInfo.Group.Evaluate(summaryExpression)); } GridViewHierarchyRowInfo hierarchyRowInfo = row as GridViewHierarchyRowInfo; if (hierarchyRowInfo != null) { return(hierarchyRowInfo.ActiveView.Evaluate(summaryExpression, (IEnumerable <GridViewRowInfo>)hierarchyRowInfo.ActiveView.ChildRows)); } GridViewTemplate gridViewTemplate = row as GridViewTemplate; if (gridViewTemplate != null) { return(gridViewTemplate.DataView.Evaluate(summaryExpression, 0, gridViewTemplate.DataView.Count)); } return(obj); }
protected override List <CharacterRange> GetSearchHighlightRanges() { List <CharacterRange> characterRangeList = new List <CharacterRange>(); GridViewGroupRowInfo rowInfo = this.RowInfo as GridViewGroupRowInfo; if (rowInfo == null) { return(characterRangeList); } GridViewColumn groupedColumnInfo = this.GetGroupedColumnInfo(rowInfo); if (groupedColumnInfo == null || !this.RowInfo.SearchCache.Contains((object)groupedColumnInfo)) { return(characterRangeList); } string str = this.RowInfo.SearchCache[(object)groupedColumnInfo] as string; int First = -1; while (First + 1 < this.Text.Length) { First = !this.MasterTemplate.MasterViewInfo.TableSearchRow.CaseSensitive ? this.MasterTemplate.MasterViewInfo.TableSearchRow.Culture.CompareInfo.IndexOf(this.Text, str, First + 1, this.MasterTemplate.MasterViewInfo.TableSearchRow.CompareOptions) : this.Text.IndexOf(str, First + 1); if (First >= 0) { characterRangeList.Add(new CharacterRange(First, str.Length)); } if (First < 0 || characterRangeList.Count >= 32) { break; } } return(characterRangeList); }
protected virtual CellPrintElement CreateGroupCellPrintElement( GridViewGroupRowInfo row) { CellPrintElement cellPrintElement1 = new CellPrintElement(); cellPrintElement1.BackColor = this.GridView.PrintStyle.GroupRowBackColor; cellPrintElement1.BorderColor = this.GridView.PrintStyle.BorderColor; Color backColor = cellPrintElement1.BackColor; if (cellPrintElement1.BackColor != Color.Transparent && cellPrintElement1.BackColor != Color.Empty) { cellPrintElement1.DrawFill = true; } string summary = row.GetSummary(); cellPrintElement1.Text = row.HeaderText; if (summary.Length > 0) { CellPrintElement cellPrintElement2 = cellPrintElement1; cellPrintElement2.Text = cellPrintElement2.Text + " | " + summary; } if (this.GridView.RightToLeft == RightToLeft.Yes) { cellPrintElement1.StringFormatFlags |= StringFormatFlags.DirectionRightToLeft; } cellPrintElement1.TextAlignment = ContentAlignment.MiddleLeft; return(cellPrintElement1); }
protected virtual bool MatchesSearchCriteria( string searchCriteria, GridViewRowInfo row, GridViewColumn col) { if (row == null || searchCriteria == null || searchCriteria.Length == 0) { return(false); } GridViewGroupRowInfo viewGroupRowInfo = row as GridViewGroupRowInfo; if (col == null && viewGroupRowInfo == null) { return(false); } string source = viewGroupRowInfo == null?this.GetCellFormattedValue(row, col) : viewGroupRowInfo.HeaderText; if (source == null) { return(false); } CompareOptions options = CompareOptions.Ordinal; if (!this.CaseSensitive) { options = this.CompareOptions; } return(this.Culture.CompareInfo.IndexOf(source, searchCriteria, options) >= 0); }
public DataGroup(object key, Group <GridViewRowInfo> parent, GridViewTemplate viewTemplate) : base(key, parent) { this.isValid = true; this.groupRow = new GridViewGroupRowInfo(viewTemplate.MasterViewInfo, this); this.groupRow.SuspendPropertyNotifications(); this.groupRow.IsExpanded = viewTemplate.AutoExpandGroups; this.groupRow.ResumePropertyNotifications(); }
public override bool IsCompatible(GridViewRowInfo data, object context) { GridViewGroupRowInfo viewGroupRowInfo = data as GridViewGroupRowInfo; if (viewGroupRowInfo != null) { return(viewGroupRowInfo.GroupLevel == this.groupLevel); } return(false); }
bool IReadOnlyCollection <GridViewRowInfo> .Contains( GridViewRowInfo value) { GridViewGroupRowInfo viewGroupRowInfo = value as GridViewGroupRowInfo; if (viewGroupRowInfo == null) { return(false); } return(this.IndexOf((Group <GridViewRowInfo>)viewGroupRowInfo.Group) >= 0); }
int IReadOnlyCollection <GridViewRowInfo> .IndexOf( GridViewRowInfo value) { GridViewGroupRowInfo viewGroupRowInfo = value as GridViewGroupRowInfo; if (viewGroupRowInfo == null) { return(-1); } return(this.IndexOf((Group <GridViewRowInfo>)viewGroupRowInfo.Group)); }
private GridViewColumn GetGroupedColumnInfo(GridViewGroupRowInfo groupRow) { GridViewColumn gridViewColumn = (GridViewColumn)null; if (groupRow.Group.GroupDescriptor == null) { gridViewColumn = (GridViewColumn)this.ViewTemplate.Columns[this.ViewTemplate.GroupDescriptors[groupRow.GroupLevel].GroupNames[0].PropertyName]; } else if (groupRow.Group.GroupDescriptor.GroupNames.Count > 0) { gridViewColumn = (GridViewColumn)this.ViewTemplate.Columns[groupRow.Group.GroupDescriptor.GroupNames[0].PropertyName]; } return(gridViewColumn); }
protected virtual bool EnsureRowVisibleByTraverser( RadScrollBarElement vScrollBar, GridViewRowInfo rowInfo, float delta) { ScrollableRowsContainerElement scrollableRows = this.ViewElement.ScrollableRows; RadElementCollection children = scrollableRows.Children; int num1 = vScrollBar.Maximum - vScrollBar.LargeChange + 1; while (vScrollBar.Maximum != 0 && children.Count == 0) { this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value + 1); this.UpdateLayout(); if (scrollableRows.Children.Count > 0 || vScrollBar.Value == num1 || vScrollBar.Value == vScrollBar.Maximum) { break; } } if (children.Count == 0) { return(false); } if (this.EnsureRowVisibleByTraverserDown(vScrollBar, rowInfo, scrollableRows, delta)) { return(true); } GridRowElement child = (GridRowElement)scrollableRows.Children[0]; if (((GridTraverser)((IEnumerable)this.RowScroller).GetEnumerator()).Current == rowInfo) { int num2 = vScrollBar.Value - (int)delta; if (num2 < vScrollBar.Minimum) { num2 = vScrollBar.Minimum; } else if (num2 > vScrollBar.Maximum) { num2 = vScrollBar.Maximum; } return(this.ChangeScrollbarValue(vScrollBar, num2)); } GridViewGroupRowInfo parent = rowInfo.Parent as GridViewGroupRowInfo; if (parent != null && !parent.IsExpanded) { return(false); } return(this.RowScroller.ScrollToItem(rowInfo, false)); }
public Group <GridViewRowInfo> CreateGroup( object key, Group <GridViewRowInfo> parent, params object[] metaData) { DataGroup dataGroup = new DataGroup(key, parent, this.owner); GridViewCreateRowInfoEventArgs e = new GridViewCreateRowInfoEventArgs((GridViewRowInfo)dataGroup.GroupRow, this.owner.MasterViewInfo); this.owner.OnCreateRowInfo(e); GridViewGroupRowInfo rowInfo = e.RowInfo as GridViewGroupRowInfo; if (rowInfo != null && rowInfo != dataGroup.GroupRow) { rowInfo.ViewInfo = this.owner.MasterViewInfo; dataGroup.GroupRow = rowInfo; } return((Group <GridViewRowInfo>)dataGroup); }
private void CheckAllCheckBoxInChildRows(GridViewGroupRowInfo row, object state) { List <GridViewRowInfo> gridViewRowInfoList = new List <GridViewRowInfo>(); foreach (GridViewRowInfo childRow in row.ChildRows) { gridViewRowInfoList.Add(childRow); } foreach (GridViewRowInfo gridViewRowInfo in gridViewRowInfoList) { GridViewGroupRowInfo row1 = gridViewRowInfo as GridViewGroupRowInfo; if (row1 != null) { this.CheckAllCheckBoxInChildRows(row1, state); } else { gridViewRowInfo.Cells[this.ColumnIndex].Value = state; } } }
private GridViewRowInfo GetNext(GridViewRowInfo row) { IHierarchicalRow current1 = (IHierarchicalRow)row; IHierarchicalRow parent1 = row.Parent ?? (IHierarchicalRow)row.ViewTemplate; Stack <GridViewRowCollection.Navigator> navigatorStack = new Stack <GridViewRowCollection.Navigator>(); GridViewRowCollection.Navigator navigator1 = new GridViewRowCollection.Navigator(parent1, current1); navigatorStack.Push(navigator1); while (navigatorStack.Count > 0) { GridViewRowCollection.Navigator navigator2 = navigatorStack.Pop(); IHierarchicalRow parent2 = navigator2.Parent; IHierarchicalRow current2 = navigator2.Current; if (parent2 == null) { return((GridViewRowInfo)null); } if (parent2.ChildRows.Count > 1) { int num = parent2.ChildRows.IndexOf((GridViewRowInfo)current2); if (num == parent2.ChildRows.Count - 1) { return((GridViewRowInfo)null); } GridViewGroupRowInfo viewGroupRowInfo = parent2.ChildRows[num + 1] as GridViewGroupRowInfo; if (viewGroupRowInfo == null) { return(parent2.ChildRows[num + 1]); } while (viewGroupRowInfo.Group.Groups.Count > 0) { viewGroupRowInfo = viewGroupRowInfo.Group.Groups[0].GroupRow; } return(viewGroupRowInfo.Group[0]); } GridViewRowCollection.Navigator navigator3 = new GridViewRowCollection.Navigator(parent2.Parent, parent2); navigatorStack.Push(navigator3); } return((GridViewRowInfo)null); }
public override Type GetCellType(GridViewColumn column) { GridViewGroupRowInfo rowInfo = (GridViewGroupRowInfo)this.RowInfo; GridViewIndentColumn viewIndentColumn = column as GridViewIndentColumn; if (viewIndentColumn != null) { if (rowInfo.Group.Level == viewIndentColumn.IndentLevel) { return(typeof(GridGroupExpanderCellElement)); } if (rowInfo.Group.Level < viewIndentColumn.IndentLevel) { return((Type)null); } } if (column == null) { return(typeof(GridGroupContentCellElement)); } return(base.GetCellType(column)); }
private void GetDistinctValuesFromGroupRows( GridViewRowInfo row, GridViewColumnValuesCollection distinctValues) { GridViewGroupRowInfo viewGroupRowInfo = row as GridViewGroupRowInfo; if (viewGroupRowInfo == null) { object obj = row.Cells[this.Index].Value; if (distinctValues.Contains(obj)) { return; } distinctValues.Add(obj); } else { foreach (GridViewRowInfo childRow in viewGroupRowInfo.ChildRows) { this.GetDistinctValuesFromGroupRows(childRow, distinctValues); } } }
private GridViewRowInfo GetPrev(GridViewRowInfo row) { IHierarchicalRow hierarchicalRow1 = (IHierarchicalRow)row; IHierarchicalRow hierarchicalRow2 = row.Parent ?? (IHierarchicalRow)row.ViewTemplate; Stack <IHierarchicalRow> hierarchicalRowStack = new Stack <IHierarchicalRow>(); hierarchicalRowStack.Push(hierarchicalRow2); while (hierarchicalRowStack.Count > 0) { IHierarchicalRow hierarchicalRow3 = hierarchicalRowStack.Pop(); if (hierarchicalRow3 == null) { return((GridViewRowInfo)null); } if (hierarchicalRow3.ChildRows.Count > 1) { int num = hierarchicalRow3.ChildRows.IndexOf((GridViewRowInfo)hierarchicalRow1); if (num == 0) { return((GridViewRowInfo)null); } GridViewGroupRowInfo viewGroupRowInfo = hierarchicalRow3.ChildRows[num - 1] as GridViewGroupRowInfo; if (viewGroupRowInfo == null) { return(hierarchicalRow3.ChildRows[num - 1]); } while (viewGroupRowInfo.Group.Groups.Count > 0) { viewGroupRowInfo = viewGroupRowInfo.Group.Groups[viewGroupRowInfo.Group.Groups.Count - 1].GroupRow; } return(viewGroupRowInfo.Group[viewGroupRowInfo.Group.ItemCount - 1]); } hierarchicalRow1 = hierarchicalRow3; hierarchicalRowStack.Push(hierarchicalRow3.Parent); } return((GridViewRowInfo)null); }
public override void Initialize(GridViewRowInfo rowInfo) { if (this.Children.Count == 0) { this.RowInfo = rowInfo; bool flag = false; foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>) this.TableElement.ViewElement.RowLayout.RenderColumns) { if (renderColumn is GridViewIndentColumn || renderColumn is GridViewRowHeaderColumn) { GridCellElement cell = this.CreateCell(renderColumn); if (cell != null) { if (cell is GridGroupExpanderCellElement) { this.expanderCell = (GridGroupExpanderCellElement)cell; flag = true; } if (cell is GridIndentCellElement && flag) { cell.ThemeRole = "HierarchyIndentCell"; } this.Children.Add((RadElement)cell); } else { break; } } if (renderColumn is GridViewDataColumn) { break; } } this.contentCell = (GridGroupContentCellElement)this.CreateCell((GridViewColumn)null); this.Children.Add((RadElement)this.contentCell); this.RowInfo = (GridViewRowInfo)null; } GridViewGroupRowInfo viewGroupRowInfo = (GridViewGroupRowInfo)rowInfo; this.groupLevel = viewGroupRowInfo.GroupLevel; if (viewGroupRowInfo.ChildRows.Count > 0) { int num1 = (int)this.SetValue(GridGroupHeaderRowElement.ContainsGroupsProperty, (object)(viewGroupRowInfo.Group.Groups.Count > 0)); } else { int num2 = (int)this.SetValue(GridGroupHeaderRowElement.ContainsGroupsProperty, (object)false); } base.Initialize(rowInfo); int index = 0; for (IList <GridViewColumn> renderColumns = this.TableElement.ViewElement.RowLayout.RenderColumns; index < this.Children.Count && index < renderColumns.Count; ++index) { GridCellElement child = this.Children[index] as GridCellElement; GridViewColumn column = renderColumns[index]; if (child != null) { if (child is GridGroupContentCellElement) { column = (GridViewColumn)null; } child.Initialize(column, (GridRowElement)this); } } if (this.expanderCell == null) { return; } this.expanderCell.Initialize(this.expanderCell.ColumnInfo, (GridRowElement)this); }
protected virtual void TraverseRows(DoWorkEventArgs e = null) { if (e != null) { e.Result = (object)false; } bool flag = false; GridViewRowInfo currentRow = this.ViewTemplate.MasterTemplate.Owner.CurrentRow; GridSearchResultCellCollection resultCells = (GridSearchResultCellCollection)null; IEnumerator enumerator = (IEnumerator)this.CreateTraverser(); if (this.ViewTemplate.MasterTemplate.EnablePaging) { enumerator = this.CreatePagedTraverser(this.ViewTemplate.MasterTemplate.EnableGrouping && this.ViewTemplate.MasterTemplate.GroupDescriptors.Count > 0); } int traverserRowIndex = -1; while (enumerator.MoveNext()) { ++traverserRowIndex; if (GridViewSearchRowInfo.Cancel && !this.IsSearchAsync) { GridViewSearchRowInfo.Cancel = false; e.Result = (object)true; return; } if (!(enumerator.Current is GridViewTableHeaderRowInfo) && !(enumerator.Current is GridViewNewRowInfo) && (!(enumerator.Current is GridViewFilteringRowInfo) && !(enumerator.Current is GridViewSearchRowInfo))) { if (this.SearchFromCurrentPosition) { if (enumerator.Current == currentRow) { flag = true; } if (currentRow != null && !flag) { continue; } } GridViewGroupRowInfo current1 = enumerator.Current as GridViewGroupRowInfo; if (current1 != null) { if (GridViewSearchRowInfo.Cancel && !this.IsSearchAsync) { GridViewSearchRowInfo.Cancel = false; e.Result = (object)true; return; } if (this.MatchesSearchCriteria(this.searchCriteria, (GridViewRowInfo)current1, (GridViewColumn)null)) { GridViewColumn groupedColumnInfo = this.GetGroupedColumnInfo(current1); if (current1.SearchCache.ContainsKey((object)groupedColumnInfo)) { current1.SearchCache[(object)groupedColumnInfo] = (object)this.searchCriteria; } else { current1.SearchCache.Add((object)groupedColumnInfo, (object)this.searchCriteria); } GridSearchResultCellInfo resultCell = new GridSearchResultCellInfo((GridViewRowInfo)current1, (GridViewColumn)null, traverserRowIndex, 0); if (this.searchResult.Count < this.InitialSearchResultsTreshold) { this.ReportSearchProgress(0, resultCell, (GridSearchResultCellCollection)null); } else { if (resultCells == null) { resultCells = new GridSearchResultCellCollection(this.SearchResultsGroupSize); } resultCells.Add(resultCell); if (resultCells.Count == this.SearchResultsGroupSize) { this.ReportSearchProgress(0, (GridSearchResultCellInfo)null, resultCells); resultCells = (GridSearchResultCellCollection)null; } } } } else { GridViewRowInfo current2 = enumerator.Current as GridViewRowInfo; int traverserColumnIndex = -1; for (int index = 0; index < current2.ViewTemplate.Columns.Count; ++index) { GridViewColumn column = (GridViewColumn)current2.ViewTemplate.Columns[index]; ++traverserColumnIndex; if (GridViewSearchRowInfo.Cancel && !this.IsSearchAsync) { GridViewSearchRowInfo.Cancel = false; e.Result = (object)true; return; } GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn; if ((gridViewDataColumn == null || gridViewDataColumn.AllowSearching) && (column.IsVisible && !column.IsGrouped) && (!(column is GridViewImageColumn) && this.MatchesSearchCriteria(this.searchCriteria, current2, column))) { if (current2.SearchCache.ContainsKey((object)column)) { current2.SearchCache[(object)column] = (object)this.searchCriteria; } else { current2.SearchCache.Add((object)column, (object)this.searchCriteria); } GridSearchResultCellInfo resultCell = new GridSearchResultCellInfo(current2, column, traverserRowIndex, traverserColumnIndex); if (this.searchResult.Count < this.InitialSearchResultsTreshold) { this.ReportSearchProgress(0, resultCell, (GridSearchResultCellCollection)null); } else { if (resultCells == null) { resultCells = new GridSearchResultCellCollection(); } resultCells.Add(resultCell); if (resultCells.Count == this.SearchResultsGroupSize) { this.ReportSearchProgress(0, (GridSearchResultCellInfo)null, resultCells); resultCells = (GridSearchResultCellCollection)null; } } } } } } } if (resultCells != null && resultCells.Count > 0) { this.ReportSearchProgress(100, (GridSearchResultCellInfo)null, resultCells); } else { this.ReportSearchProgress(100, (GridSearchResultCellInfo)null, (GridSearchResultCellCollection)null); } }
private GridViewColumn GetGroupedColumnInfo(GridViewGroupRowInfo groupRow) { return(groupRow.Group.GroupDescriptor != null ? (GridViewColumn)groupRow.ViewTemplate.Columns[groupRow.Group.GroupDescriptor.GroupNames[0].PropertyName] : (GridViewColumn)groupRow.ViewTemplate.Columns[groupRow.ViewTemplate.GroupDescriptors[groupRow.GroupLevel].GroupNames[0].PropertyName]); }
private object EvaluateExpression(GridViewRowInfo row, GridViewColumn column) { if (row.ViewTemplate.MasterTemplate.Owner.InvokeRequired) { object result = (object)null; row.ViewTemplate.MasterTemplate.Owner.Invoke((Delegate)(() => result = this.EvaluateExpression(row, column))); return(result); } ExpressionNode expressionNode; if (DataUtils.TryParse(column.Expression, row.ViewTemplate.CaseSensitive, out expressionNode)) { ExpressionContext context = ExpressionContext.Context; bool containsAggregate = false; List <GridViewColumn> columnsForExpression = this.GetColumnsForExpression(row.ViewTemplate, expressionNode, out containsAggregate); for (int index1 = 0; index1 < columnsForExpression.Count; ++index1) { if (columnsForExpression[index1] != column) { GridViewColumn index2 = columnsForExpression[index1]; Accessor accessor = index2.Accessor; object obj = !(accessor is ExpressionAccessor) || !row.Cache.ContainsKey((object)index2) ? accessor[row] : row.Cache[index2]; if (context.ContainsKey(index2.Name)) { context[index2.Name] = obj; } else { context.Add(index2.Name, obj); } } } AggregateData aggregateData = (AggregateData)null; if (containsAggregate) { GridViewGroupRowInfo parent = row.Parent as GridViewGroupRowInfo; aggregateData = parent == null ? new AggregateData((IEnumerable <GridViewRowInfo>)row.ViewTemplate.ChildRows) : new AggregateData((IEnumerable <GridViewRowInfo>)parent.ChildRows); } try { object obj1 = expressionNode.Eval((object)aggregateData, (object)context); object obj2 = RadDataConverter.Instance.Parse(column as IDataConversionInfoProvider, obj1); row.Cache[column] = obj2; } catch (InvalidExpressionException ex) { if (!ExpressionAccessor.ExpressionErrorRaised) { string message = string.Format("Invalid Expression: \n\"{0}\"", (object)ex.Message); row.ViewTemplate.SetError(new GridViewCellCancelEventArgs(row, column, (IInputEditor)null), DataUtils.CreateInvalidExpressionException(message)); ExpressionAccessor.ExpressionErrorRaised = true; } } } else if (!ExpressionAccessor.ExpressionErrorRaised) { if (!string.IsNullOrEmpty(column.HeaderText)) { string headerText = column.HeaderText; } else if (!string.IsNullOrEmpty(column.FieldName)) { string fieldName = column.FieldName; } else if (!string.IsNullOrEmpty(column.Name)) { string name = column.Name; } else { string empty = string.Empty; } string message = string.Format("Invalid expression value for [{0}] column!", (object)column.Name); row.ViewTemplate.SetError(new GridViewCellCancelEventArgs(row, column, (IInputEditor)null), DataUtils.CreateInvalidExpressionException(message)); ExpressionAccessor.ExpressionErrorRaised = true; } return(row.Cache[column]); }
private bool CheckCheckBoxValueForAllRows( GridViewRowInfo row, bool foundMatchingRow, Telerik.WinControls.Enumerations.ToggleState togglestate) { if (foundMatchingRow) { return(foundMatchingRow); } foreach (GridViewRowInfo gridViewRowInfo in !(row is GridViewGroupRowInfo) || !row.HasChildRows() ? row.ViewInfo.Rows : row.ChildRows) { GridViewGroupRowInfo viewGroupRowInfo = gridViewRowInfo as GridViewGroupRowInfo; if (viewGroupRowInfo != null) { foundMatchingRow = this.CheckCheckBoxValueForAllRows((GridViewRowInfo)viewGroupRowInfo, foundMatchingRow, togglestate); } else { object obj = gridViewRowInfo.Cells[this.ColumnIndex].Value; bool? nullable = new bool?(); if (this.ColumnInfo is GridViewDataColumn) { TypeConverter dataTypeConverter = ((GridViewDataColumn)this.ColumnInfo).DataTypeConverter; if (dataTypeConverter != null) { if (!dataTypeConverter.CanConvertTo(typeof(bool))) { if (!dataTypeConverter.CanConvertTo(typeof(Telerik.WinControls.Enumerations.ToggleState))) { goto label_20; } } try { if (dataTypeConverter.CanConvertTo(typeof(Telerik.WinControls.Enumerations.ToggleState))) { Telerik.WinControls.Enumerations.ToggleState toggleState = Telerik.WinControls.Enumerations.ToggleState.Indeterminate; if (!(obj is DBNull) && obj != null) { toggleState = (Telerik.WinControls.Enumerations.ToggleState)dataTypeConverter.ConvertTo(obj, typeof(Telerik.WinControls.Enumerations.ToggleState)); } switch (toggleState) { case Telerik.WinControls.Enumerations.ToggleState.On: nullable = new bool?(true); goto label_22; case Telerik.WinControls.Enumerations.ToggleState.Indeterminate: nullable = new bool?(); goto label_22; default: nullable = new bool?(false); goto label_22; } } else { nullable = new bool?(Convert.ToBoolean(dataTypeConverter.ConvertTo(obj, typeof(bool)))); goto label_22; } } catch (FormatException ex) { goto label_22; } catch (NotSupportedException ex) { goto label_22; } } label_20: bool result = false; if (bool.TryParse(string.Concat(obj), out result)) { nullable = new bool?(result); } } label_22: try { if (!this.checkBox.IsThreeState) { if ((gridViewRowInfo == this.RowInfo || obj != null && obj != DBNull.Value) && (!nullable.HasValue || nullable.Value)) { if (!nullable.HasValue) { if (Convert.ToBoolean(obj)) { continue; } } else { continue; } } foundMatchingRow = true; } else { if ((obj == null || obj == DBNull.Value || !nullable.HasValue) && togglestate == Telerik.WinControls.Enumerations.ToggleState.Indeterminate) { foundMatchingRow = true; } if (gridViewRowInfo != this.RowInfo && (obj == null || obj == DBNull.Value) || nullable.HasValue && nullable.Value && togglestate == Telerik.WinControls.Enumerations.ToggleState.On || !nullable.HasValue && Convert.ToBoolean(obj) && togglestate == Telerik.WinControls.Enumerations.ToggleState.On) { foundMatchingRow = true; } if ((gridViewRowInfo == this.RowInfo || obj != null && obj != DBNull.Value) && (!nullable.HasValue || nullable.Value || togglestate != Telerik.WinControls.Enumerations.ToggleState.Off)) { if (!nullable.HasValue) { if (!Convert.ToBoolean(obj)) { if (togglestate != Telerik.WinControls.Enumerations.ToggleState.Off) { continue; } } else { continue; } } else { continue; } } foundMatchingRow = true; } } catch (FormatException ex) { } catch (InvalidCastException ex) { } } } return(foundMatchingRow); }
protected virtual void checkbox_ToggleStateChanged(object sender, StateChangedEventArgs args) { if (this.suspendProcessingToggleStateChanged) { return; } if (this.ViewTemplate != null && !this.ViewTemplate.IsSelfReference && !this.MasterTemplate.IsSelfReference) { this.MasterTemplate.BeginUpdate(); } else { this.TableElement.BeginUpdate(); } object state = (object)DBNull.Value; if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { state = (object)true; } else if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.Off) { state = (object)false; } else if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.Indeterminate) { state = (object)null; } this.RaiseToggleStateEvent(); if (!this.shouldCheckDataRows) { if (this.ViewTemplate == null || this.ViewTemplate.IsSelfReference || this.MasterTemplate.IsSelfReference) { return; } this.MasterTemplate.EndUpdate(true, new DataViewChangedEventArgs(ViewChangedAction.DataChanged)); } else { this.GridViewElement.EditorManager.EndEdit(); this.TableElement.BeginUpdate(); this.MasterTemplate.MasterViewInfo.TableSearchRow.SuspendSearch(); GridViewColumn columnInfo = this.ColumnInfo; bool shouldCheckDataRows = this.shouldCheckDataRows; this.shouldCheckDataRows = false; List <FilterDescriptor> filterDescriptorList = new List <FilterDescriptor>(); for (int index = 0; index < this.ViewTemplate.Columns.Count; ++index) { filterDescriptorList.Add(this.ViewTemplate.Columns[index].FilterDescriptor); this.ViewTemplate.Columns[index].FilterDescriptor = (FilterDescriptor)null; } List <GridViewRowInfo> rowsToIterateOver = this.GetRowsToIterateOver(); this.suspendHeaderSynchronization = true; foreach (GridViewRowInfo gridViewRowInfo in rowsToIterateOver) { GridViewGroupRowInfo row = gridViewRowInfo as GridViewGroupRowInfo; if (row != null) { this.CheckAllCheckBoxInChildRows(row, state); } else { gridViewRowInfo.Cells[this.ColumnIndex].Value = state; } } this.suspendHeaderSynchronization = false; this.MasterTemplate.MasterViewInfo.TableSearchRow.ResumeSearch(); this.TableElement.EndUpdate(false); this.TableElement.Update(GridUINotifyAction.DataChanged); if (this.ViewTemplate != null && !this.ViewTemplate.IsSelfReference && !this.MasterTemplate.IsSelfReference) { this.MasterTemplate.EndUpdate(true, new DataViewChangedEventArgs(ViewChangedAction.DataChanged)); } else { this.TableElement.EndUpdate(false); } if (this.ViewTemplate != null) { for (int index = 0; index < filterDescriptorList.Count; ++index) { this.ViewTemplate.Columns[index].FilterDescriptor = filterDescriptorList[index]; } } this.shouldCheckDataRows = shouldCheckDataRows; } }
public GridViewSummaryRowInfo(GridViewInfo gridViewInfo, GridViewGroupRowInfo group) : base(gridViewInfo) { this.groupRow = group; }
public virtual void Search(string criteria) { if (this.IsSearchSuspended) { return; } this.searchCriteria = criteria; this.selectionChangedByUser = false; if (this.worker.IsBusy) { if (!this.worker.CancellationPending && !GridViewSearchRowInfo.Cancel) { this.worker.CancelAsync(); GridViewSearchRowInfo.Cancel = true; } Application.DoEvents(); } foreach (GridSearchResultCellInfo searchResultCellInfo in (List <GridSearchResultCellInfo>) this.searchResult) { searchResultCellInfo.RowInfo.SearchCache.Clear(); } string cacheKey = this.GetCacheKey(); if (this.cache.ContainsKey((object)cacheKey)) { this.searchResult = new GridSearchResultCellCollection((IEnumerable <GridSearchResultCellInfo>)(this.cache[(object)cacheKey] as GridSearchResultCellCollection)); this.searchResultCurrentIndex = -1; foreach (GridSearchResultCellInfo searchResultCellInfo in (List <GridSearchResultCellInfo>) this.searchResult) { GridViewGroupRowInfo rowInfo = searchResultCellInfo.RowInfo as GridViewGroupRowInfo; GridViewColumn gridViewColumn = searchResultCellInfo.ColumnInfo; if (rowInfo != null) { gridViewColumn = this.GetGroupedColumnInfo(rowInfo); } GridViewDataColumn gridViewDataColumn = gridViewColumn as GridViewDataColumn; if (gridViewDataColumn == null || gridViewDataColumn.AllowSearching) { if (searchResultCellInfo.RowInfo.SearchCache.ContainsKey((object)gridViewColumn)) { searchResultCellInfo.RowInfo.SearchCache[(object)gridViewColumn] = (object)criteria; } else { searchResultCellInfo.RowInfo.SearchCache.Add((object)gridViewColumn, (object)criteria); } } } if (this.searchResult.Count > 0 && this.AutomaticallySelectFirstResult) { this.SelectNextSearchResult(); } this.OnSearchProgressChanged(new SearchProgressChangedEventArgs(this.searchCriteria, (GridSearchResultCellInfo)null, this.searchResult, true)); } else { while (this.worker.IsBusy) { Application.DoEvents(); } this.searchResult.Clear(); this.searchResultCurrentIndex = -1; GridViewSearchRowInfo.Cancel = false; if (!string.IsNullOrEmpty(criteria)) { this.isSearching = true; if (this.IsSearchAsync) { this.worker.RunWorkerAsync((object)criteria); } else { this.TraverseRows((DoWorkEventArgs)null); } } else { this.OnSearchProgressChanged(new SearchProgressChangedEventArgs(this.searchCriteria, (GridSearchResultCellInfo)null, this.searchResult, true)); } } }