private void items_ItemsChanged( RadItemCollection changed, RadItem target, ItemsChangeOperation operation) { if (target != null && !typeof(RadTileElement).IsAssignableFrom(target.GetType())) { throw new ArgumentException("The Items collection accepts only objects or descendants of type RadTileElement"); } RadTileElement tileElement = target as RadTileElement; RadControl control = this.ElementTree.Control as RadControl; if (control != null && control.IsInitializing || this.ElementTree.Control.Site != null) { return; } if (this.AutoArrangeNewTiles && tileElement != null && operation == ItemsChangeOperation.Inserted) { int num1 = 0; int num2 = 0; bool flag = false; if (tileElement.GetValueSource(GridLayout.ColumnIndexProperty) > ValueSource.DefaultValue || tileElement.GetValueSource(GridLayout.RowIndexProperty) > ValueSource.DefaultValue) { this.UpdateCellCount(); this.InvalidateMeasure(); return; } int col = 0; while (!flag) { for (int row = 0; !flag && row < this.RowsCount; ++row) { if (this.CanPlace(tileElement, row, col)) { num1 = row; num2 = col; flag = true; } } ++col; } tileElement.Column = num2; tileElement.Row = num1; } this.UpdateCellCount(); this.InvalidateMeasure(); }
private void items_ItemsChanged( RadItemCollection changed, RadItem target, ItemsChangeOperation operation) { RadTileElement tileElement = target as RadTileElement; RadPanoramaElement ancestor = this.FindAncestor <RadPanoramaElement>(); RadControl radControl = this.ElementTree != null ? this.ElementTree.Control as RadControl : (RadControl)null; if (radControl == null || radControl.IsInitializing || this.DesignMode) { return; } if (ancestor != null && ancestor.AutoArrangeNewTiles && (tileElement != null && operation == ItemsChangeOperation.Inserted)) { int num1 = 0; int num2 = 0; bool flag = false; if (tileElement.GetValueSource(GridLayout.ColumnIndexProperty) > ValueSource.DefaultValue || tileElement.GetValueSource(GridLayout.RowIndexProperty) > ValueSource.DefaultValue) { this.UpdateCellCount(); this.InvalidateMeasure(); return; } int col = 0; while (!flag) { for (int row = 0; !flag && row < this.RowsCount; ++row) { if (this.CanPlace(tileElement, row, col)) { num1 = row; num2 = col; flag = true; } } ++col; } tileElement.Column = num2; tileElement.Row = num1; } this.UpdateCellCount(); this.InvalidateMeasure(); }