private void ProcessFilterDescriptorCollectionChanged(NotifyCollectionChangedEventArgs e)
 {
     if (this.update > 0)
     {
         return;
     }
     if (e.Action == NotifyCollectionChangedAction.Reset)
     {
         this.ProcessViewChanged(new DataViewChangedEventArgs(ViewChangedAction.Reset));
     }
     else if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         GridViewDataColumn filterDescriptor = this.GetDataColumnByFilterDescriptor(e.NewItems[0] as FilterDescriptor);
         if (filterDescriptor == null)
         {
             return;
         }
         this.CreateFilterDescriptor(filterDescriptor, this.GetDefaultFilterOperator(filterDescriptor));
     }
     else
     {
         if (e.Action != NotifyCollectionChangedAction.Add && e.Action != NotifyCollectionChangedAction.ItemChanged)
         {
             return;
         }
         FilterDescriptor   newItem          = e.NewItems[0] as FilterDescriptor;
         GridViewDataColumn filterDescriptor = this.GetDataColumnByFilterDescriptor(newItem);
         if (filterDescriptor == null)
         {
             return;
         }
         this.Cache[(GridViewColumn)filterDescriptor] = (object)newItem;
     }
 }
        public virtual string GetCellFormattedValue(GridViewRowInfo row, GridViewColumn column)
        {
            GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;

            if (gridViewDataColumn == null || string.IsNullOrEmpty(gridViewDataColumn.FormatString) && !(gridViewDataColumn is GridViewComboBoxColumn))
            {
                Convert.ToString(row[column]);
            }
            GridViewComboBoxColumn viewComboBoxColumn1 = gridViewDataColumn as GridViewComboBoxColumn;
            object lookupValue = row[column];

            if (viewComboBoxColumn1 != null && viewComboBoxColumn1.HasLookupValue)
            {
                lookupValue = viewComboBoxColumn1.GetLookupValue(lookupValue);
            }
            GridDataConversionInfo dataConversionInfo  = new GridDataConversionInfo(column as IDataConversionInfoProvider);
            GridViewComboBoxColumn viewComboBoxColumn2 = column as GridViewComboBoxColumn;

            if (viewComboBoxColumn2 != null)
            {
                dataConversionInfo.DataType          = viewComboBoxColumn2.DisplayMemberDataType;
                dataConversionInfo.DataTypeConverter = TypeDescriptor.GetConverter(viewComboBoxColumn2.DisplayMemberDataType);
            }
            return(RadDataConverter.Instance.Format(lookupValue, typeof(string), (IDataConversionInfoProvider)dataConversionInfo) as string);
        }
        internal bool SetFilterDesriptor(GridViewDataColumn dataColumn, FilterDescriptor descriptor)
        {
            bool             isDetached        = false;
            bool             flag              = false;
            FilterDescriptor filterDescriptor1 = this.GetFilterDescriptor(dataColumn, out isDetached);

            this.SuspendUpdate();
            if (dataColumn.SetFilterDescriptor(descriptor))
            {
                if (descriptor != null)
                {
                    this.Cache[(GridViewColumn)dataColumn] = (object)descriptor;
                }
                flag = true;
            }
            if ((isDetached || flag) && descriptor == null)
            {
                filterDescriptor1.Operator = FilterOperator.None;
                if (filterDescriptor1 is CompositeFilterDescriptor)
                {
                    dataColumn.FilterDescriptor = (FilterDescriptor)null;
                    FilterDescriptor filterDescriptor2 = new FilterDescriptor(dataColumn.Name, FilterOperator.None, (object)null);
                    this.Cache[(GridViewColumn)dataColumn] = (object)filterDescriptor2;
                }
            }
            this.ResumeUpdate();
            return(flag);
        }
        public override void Initialize(
            GridViewDataColumn dataColumn,
            FilterDescriptor filterDescriptor,
            bool useTypedEditors)
        {
            GridViewComboBoxColumn viewComboBoxColumn1 = dataColumn as GridViewComboBoxColumn;

            if (filterDescriptor == null)
            {
                System.Type            dataType            = dataColumn.DataType;
                GridViewComboBoxColumn viewComboBoxColumn2 = dataColumn as GridViewComboBoxColumn;
                if (viewComboBoxColumn2 != null)
                {
                    dataType = viewComboBoxColumn2.FilteringMemberDataType;
                }
                FilterOperator defaultFilterOperator = GridViewHelper.GetDefaultFilterOperator(dataType);
                filterDescriptor = !(dataColumn is GridViewDateTimeColumn) ? new FilterDescriptor(dataColumn.Name, defaultFilterOperator, (object)null) : (FilterDescriptor) new DateFilterDescriptor(dataColumn.Name, defaultFilterOperator, new DateTime?(), false);
            }
            this.dataType = viewComboBoxColumn1 == null ? dataColumn.DataType : viewComboBoxColumn1.FilteringMemberDataType;
            this.column   = dataColumn;
            this.InitialSetFilterDescriptor(filterDescriptor);
            if (useTypedEditors)
            {
                this.CreateEditors((GridViewColumn)this.column);
            }
            else
            {
                this.CreateEditors((GridViewColumn)null);
            }
            this.LocalizeForm();
        }
Example #5
0
 public FilterPopupInitializedEventArgs(
     GridViewDataColumn dataColumn,
     IGridFilterPopup filterPopup)
 {
     this.dataColumn  = dataColumn;
     this.filterPopup = filterPopup;
 }
Example #6
0
 public RadDateFilterPopup(GridViewDataColumn dataColumn)
 {
     this.DataColumn = dataColumn;
     this.Size       = RadDateFilterPopup.Popup_Size;
     this.InitializeElements();
     this.PopupOpened += new RadPopupOpenedEventHandler(this.RadDateFilterPopup_PopupOpened);
 }
Example #7
0
        private void UpdateFormattingObject()
        {
            BaseFormattingObject formattingObject1 = (BaseFormattingObject)null;

            if (this.SupportsConditionalFormatting)
            {
                foreach (GridViewColumn column in (Collection <GridViewDataColumn>) this.ViewTemplate.Columns)
                {
                    GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;
                    if (gridViewDataColumn != null)
                    {
                        foreach (BaseFormattingObject formattingObject2 in (Collection <BaseFormattingObject>)gridViewDataColumn.ConditionalFormattingObjectList)
                        {
                            if (!formattingObject2.ApplyOnSelectedRows && this.RowInfo.IsSelected)
                            {
                                this.UnsetFormattingObjectProperties(formattingObject2, formattingObject1);
                            }
                            else if (formattingObject2.ApplyToRow && formattingObject2.Evaluate(this.RowInfo, (GridViewColumn)gridViewDataColumn))
                            {
                                if (formattingObject1 == null)
                                {
                                    formattingObject1 = new BaseFormattingObject();
                                }
                                this.SetFormattingObjectProperties(formattingObject2, formattingObject1);
                            }
                        }
                    }
                }
            }
            this.SetFormattingObject(formattingObject1);
        }
Example #8
0
 public override void InvalidateRenderColumns()
 {
     base.InvalidateRenderColumns();
     foreach (DisposableObject disposableObject in this.groupColumns.Values)
     {
         disposableObject.Dispose();
     }
     this.systemColumns.Clear();
     this.groupColumns.Clear();
     this.scrollableColumns.Clear();
     foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>) this.RenderColumns)
     {
         this.systemColumns.Add(renderColumn);
     }
     this.lastPinnedLeftPosition = this.RenderColumns.Count;
     this.lastScrollablePosition = this.RenderColumns.Count;
     foreach (GridViewColumnGroup columnGroup in (Collection <GridViewColumnGroup>) this.ViewDefinition.ColumnGroups)
     {
         this.AddGroupColumn(columnGroup);
     }
     foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>) this.RenderColumns)
     {
         GridViewDataColumn column = renderColumn as GridViewDataColumn;
         if (column != null)
         {
             this.SetFirstDataColumn(column);
             break;
         }
     }
     this.tree.Rebuild(this.ViewDefinition.ColumnGroups);
 }
Example #9
0
 public RadListFilterPopup(GridViewDataColumn dataColumn, bool groupedDateValues)
 {
     this.groupedDateValues = groupedDateValues;
     this.DataColumn        = dataColumn;
     this.tableElement      = this.DataColumn.OwnerTemplate.MasterTemplate.Owner.TableElement;
     this.InitializeElements();
     this.Size = RadListFilterPopup.Popup_Size;
 }
Example #10
0
 public RadSimpleListFilterPopup(GridViewDataColumn dataColumn)
 {
     this.DataColumn   = dataColumn;
     this.tableElement = this.DataColumn.OwnerTemplate.MasterTemplate.Owner.TableElement;
     this.InitializeElements();
     this.Size         = RadSimpleListFilterPopup.Popup_Size;
     this.PopupOpened += new RadPopupOpenedEventHandler(this.RadSimpleListFilterPopup_PopupOpened);
 }
        protected override void UpdateInfoCore()
        {
            GridViewDataColumn columnInfo = this.ColumnInfo as GridViewDataColumn;

            this.UpdateItemsVisibility(columnInfo == null || columnInfo.AllowFiltering);
            base.UpdateInfoCore();
            this.SetSelectedFilterOperatorText();
        }
Example #12
0
 public CompositeFilterForm(
     GridViewDataColumn dataColumn,
     FilterDescriptor filterDescriptor,
     bool useTypedEditors)
     : this()
 {
     this.Initialize(dataColumn, filterDescriptor, useTypedEditors);
 }
        protected override void DropInColumnGroupsView(
            ColumnGroupsViewDefinition view,
            GridViewColumn column,
            RadPosition dropPosition)
        {
            GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;

            if (gridViewDataColumn != null)
            {
                if (this.ViewTemplate.AllowColumnReorder && this.GridViewGroupColumn.Group.Groups.Count == 0)
                {
                    GridViewColumnGroupRow row = this.FindRow(view.ColumnGroups, (GridViewColumn)gridViewDataColumn);
                    if (this.GridViewGroupColumn.Group != null && this.GridViewGroupColumn.Group.Rows.Count == 0 && (dropPosition & RadPosition.Bottom) != RadPosition.None)
                    {
                        this.GridViewGroupColumn.Group.Rows.Add(new GridViewColumnGroupRow());
                    }
                    if (this.GridViewGroupColumn.Group != null && this.GridViewGroupColumn.Group.Rows.Count > 0)
                    {
                        if (row != null)
                        {
                            row.ColumnNames.Remove(gridViewDataColumn.Name);
                            if (row.ColumnNames.Count == 0)
                            {
                                this.FindGroup(view.ColumnGroups, row)?.Rows.Remove(row);
                            }
                        }
                        if ((dropPosition & RadPosition.Left) != RadPosition.None)
                        {
                            this.GridViewGroupColumn.Group.Rows[0].ColumnNames.Insert(0, gridViewDataColumn.Name);
                        }
                        else
                        {
                            this.GridViewGroupColumn.Group.Rows[0].ColumnNames.Add(gridViewDataColumn.Name);
                        }
                    }
                }
                if (!column.IsVisible && this.GridViewGroupColumn.Group.Groups.Count == 0)
                {
                    column.IsVisible = true;
                }
                else
                {
                    ColumnGroupRowLayout rowLayout = this.TableElement.ViewElement.RowLayout as ColumnGroupRowLayout;
                    rowLayout.InvalidateLayout();
                    rowLayout.InvalidateRenderColumns();
                    this.TableElement.ViewElement.UpdateRows(true);
                }
            }
            else
            {
                if (!(column is GridViewGroupColumn))
                {
                    return;
                }
                this.DropColumnGroup(view, ((GridViewGroupColumn)column).Group, dropPosition);
            }
        }
        internal FilterDescriptor CreateFilterDescriptor(
            GridViewDataColumn dataColumn,
            FilterOperator filterOperator)
        {
            FilterDescriptor filterDescriptor = !(dataColumn is GridViewDateTimeColumn) ? new FilterDescriptor(dataColumn.Name, filterOperator, (object)null) : (FilterDescriptor) new DateFilterDescriptor(dataColumn.Name, filterOperator, new DateTime?(), false);

            this.Cache[(GridViewColumn)dataColumn] = (object)filterDescriptor;
            return(filterDescriptor);
        }
Example #15
0
 public CompositeFilterForm(
     GridViewDataColumn dataColumn,
     FilterDescriptor filterDescriptor,
     bool useTypedEditors,
     string themeName)
     : this(dataColumn, filterDescriptor, useTypedEditors)
 {
     this.ThemeName = themeName;
 }
        public GridViewRowInfo FindItemExact(string text)
        {
            GridViewDataColumn displayColumn = this.OwnerComboItem.DisplayColumn;

            if (displayColumn == null)
            {
                return((GridViewRowInfo)null);
            }
            return(this.FindItemExact(text, displayColumn.FieldName));
        }
        private FilterOperator GetDefaultFilterOperator(GridViewDataColumn dataColumn)
        {
            Type dataType = dataColumn.DataType;
            GridViewComboBoxColumn viewComboBoxColumn = dataColumn as GridViewComboBoxColumn;

            if (viewComboBoxColumn != null)
            {
                dataType = viewComboBoxColumn.FilteringMemberDataType;
            }
            return(GridViewHelper.GetDefaultFilterOperator(dataType));
        }
        public void Add(object value)
        {
            string             str = this.conversionInfoProvider == null ? (!string.IsNullOrEmpty(this.formatString) ? string.Format(this.formatString, value) : Convert.ToString(value, (IFormatProvider)CultureInfo.CurrentCulture)) : RadDataConverter.Instance.Format(value, typeof(string), this.conversionInfoProvider) as string;
            GridViewDataColumn conversionInfoProvider = this.DataConversionInfoProvider as GridViewDataColumn;

            if (TelerikHelper.StringIsNullOrWhiteSpace(str) || conversionInfoProvider != null && str.Equals(conversionInfoProvider.NullValue))
            {
                str = string.Empty;
            }
            this.Add(str, value);
        }
Example #19
0
        public void ReplaceKey(GridViewDataColumn oldKey, GridViewDataColumn newKey)
        {
            if (!this.dictionary.Contains((object)oldKey))
            {
                return;
            }
            object obj = this.dictionary[(object)oldKey];

            this.dictionary.Remove((object)oldKey);
            this.dictionary.Add((object)newKey, obj);
        }
        private GridViewDataColumn GetDataColumnByFilterDescriptor(
            FilterDescriptor descriptor)
        {
            GridViewDataColumn gridViewDataColumn = (GridViewDataColumn)null;

            if (descriptor != null && descriptor.IsFilterEditor && !string.IsNullOrEmpty(descriptor.PropertyName))
            {
                gridViewDataColumn = this.ViewTemplate.Columns[descriptor.PropertyName];
            }
            return(gridViewDataColumn);
        }
Example #21
0
 protected override bool ProcessListOverride(
     XmlReader reader,
     object listOwner,
     PropertyDescriptor ownerProperty,
     IList list)
 {
     if (list is GridViewTemplateCollection)
     {
         this.ReadMergeCollection(reader, listOwner, ownerProperty, list, (string)null);
         this.loadOldChildTemplates = ownerProperty.Name.Equals("ChildGridViewTemplates", StringComparison.InvariantCultureIgnoreCase) && list.Count > 0;
         return(true);
     }
     if (list is GridViewColumnCollection)
     {
         ((ObservableCollection <GridViewDataColumn>)list).BeginUpdate();
         Dictionary <string, Type> dictionary = new Dictionary <string, Type>();
         for (int index = 0; index < list.Count; ++index)
         {
             GridViewDataColumn gridViewDataColumn = list[index] as GridViewDataColumn;
             if (gridViewDataColumn != null)
             {
                 dictionary.Add(gridViewDataColumn.Name, gridViewDataColumn.DataType);
             }
         }
         this.ReadMergeCollection(reader, listOwner, ownerProperty, list, "UniqueName", true);
         for (int index = 0; index < list.Count; ++index)
         {
             GridViewDataColumn gridViewDataColumn = list[index] as GridViewDataColumn;
             if (gridViewDataColumn != null && (object)gridViewDataColumn.DataType == null && dictionary.ContainsKey(gridViewDataColumn.Name))
             {
                 gridViewDataColumn.DataType = dictionary[gridViewDataColumn.Name];
             }
         }
         ((ObservableCollection <GridViewDataColumn>)list).EndUpdate();
         return(true);
     }
     if (list is GridViewSortDescriptorCollection)
     {
         this.loadOldSortExpressions = ownerProperty.Name.Equals("SortExpressions", StringComparison.InvariantCultureIgnoreCase);
         return(base.ProcessListOverride(reader, listOwner, ownerProperty, list));
     }
     if (list is GridViewGroupDescriptorCollection)
     {
         this.loadOldGroupExpressions = ownerProperty.Name.Equals("GroupByExpressions", StringComparison.InvariantCultureIgnoreCase);
         return(base.ProcessListOverride(reader, listOwner, ownerProperty, list));
     }
     if (!(list is GridViewFilterDescriptorCollection))
     {
         return(base.ProcessListOverride(reader, listOwner, ownerProperty, list));
     }
     this.loadOldFilterExpressions = ownerProperty.Name.Equals("FilterExpressions", StringComparison.InvariantCultureIgnoreCase);
     return(base.ProcessListOverride(reader, listOwner, ownerProperty, list));
 }
Example #22
0
        private void UpdateGroupByFieldFromColumn(GridViewDataColumn column, GridGroupByField field)
        {
            string defaultFormatString = this.defaultFormatString;

            if (string.IsNullOrEmpty(defaultFormatString) || defaultFormatString.IndexOf("{1") < 0)
            {
                defaultFormatString = this.defaultFormatString;
            }
            if (!field.IsFieldAliasSet && string.IsNullOrEmpty(column.HeaderText))
            {
                field.HeaderText = column.HeaderText;
            }
            field.FormatString = defaultFormatString;
        }
Example #23
0
 protected virtual string ApplyFormatString(object value)
 {
   if (!string.IsNullOrEmpty(this.FormatString))
   {
     CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
     GridViewDataColumn columnInfo = this.ColumnInfo as GridViewDataColumn;
     if (columnInfo != null && columnInfo.FormatInfo != null)
       cultureInfo = columnInfo.FormatInfo;
     return string.Format((IFormatProvider) cultureInfo, this.FormatString, value);
   }
   if (value != null)
     return value.ToString();
   return string.Empty;
 }
 internal override object this[GridViewColumn column]
 {
     get
     {
         GridViewDataColumn column1 = column as GridViewDataColumn;
         if (column1 != null)
         {
             return((object)this.GetSummary(column1));
         }
         return(base[column]);
     }
     set
     {
         base[column] = value;
     }
 }
Example #25
0
 public GridViewCellInfo this[string name]
 {
     get
     {
         GridViewTemplate viewTemplate = this.rowInfo.ViewTemplate;
         if (viewTemplate != null)
         {
             GridViewDataColumn column = viewTemplate.Columns[name];
             if (column != null)
             {
                 return(this.GetCellInfo((GridViewColumn)column));
             }
         }
         return((GridViewCellInfo)null);
     }
 }
        public virtual object[] GetSummaryValues(GridViewDataColumn column)
        {
            List <object> objectList = new List <object>();

            foreach (GridViewSummaryItem gridViewSummaryItem in (Collection <GridViewSummaryItem>) this.summaryRowItem)
            {
                if (gridViewSummaryItem.Name == column.Name)
                {
                    if (string.IsNullOrEmpty(gridViewSummaryItem.GetSummaryExpression()))
                    {
                        throw new ArgumentException("The aggregate expression is not set. You need to define an aggregate expression for your summary e.g. Sum, Min, Max.");
                    }
                    objectList.Add(this.ViewTemplate.DataView.Evaluate(gridViewSummaryItem.GetSummaryExpression(), this.groupRow.Group[0].Index, this.groupRow.Group.ItemCount));
                }
            }
            return(objectList.ToArray());
        }
Example #27
0
        public override void InvalidateRenderColumns()
        {
            base.InvalidateRenderColumns();
            this.arrangeInfos.Clear();
            this.systemColumns.Clear();
            this.scrollableColumns.Clear();
            foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>) this.RenderColumns)
            {
                this.systemColumns.Add(renderColumn);
                this.arrangeInfos.Add(renderColumn.GetHashCode(), new HtmlViewCellArrangeInfo((CellDefinition)null, renderColumn));
            }
            foreach (RowDefinition row in (Collection <RowDefinition>) this.RowTemplate.Rows)
            {
                foreach (CellDefinition cell in (Collection <CellDefinition>)row.Cells)
                {
                    GridViewDataColumn column = this.ViewTemplate.Columns[cell.UniqueName];
                    if (column != null && (column.IsVisible || this.IgnoreColumnVisibility))
                    {
                        this.arrangeInfos.Add(column.GetHashCode(), new HtmlViewCellArrangeInfo(cell, (GridViewColumn)column));
                        this.RenderColumns.Add((GridViewColumn)column);
                        this.scrollableColumns.Add((GridViewColumn)column);
                    }
                }
            }
            RowDefinitionsCollection rows = this.RowTemplate.Rows;

            for (int index = 0; index < rows.Count; ++index)
            {
                RowDefinition rowDefinition = rows[index];
                if (rowDefinition.Cells.Count > 0)
                {
                    this.SetFirstDataColumn(this.ViewTemplate.Columns[rowDefinition.Cells[0].UniqueName]);
                    break;
                }
            }
            for (int index = rows.Count - 1; index >= 0; --index)
            {
                RowDefinition rowDefinition = rows[index];
                int           count         = rowDefinition.Cells.Count;
                if (count > 0)
                {
                    this.SetLastDataColumn(this.ViewTemplate.Columns[rowDefinition.Cells[count - 1].UniqueName]);
                    break;
                }
            }
        }
 internal override object this[GridViewColumn column]
 {
     get
     {
         FilterDescriptor filterDescriptor = this.GetFilterDescriptor(column as GridViewDataColumn);
         if (filterDescriptor != null && filterDescriptor.Operator != FilterOperator.None && (filterDescriptor.Operator != FilterOperator.IsNull && filterDescriptor.Operator != FilterOperator.IsNotNull))
         {
             return(filterDescriptor.Value);
         }
         return((object)null);
     }
     set
     {
         bool isDetached = false;
         GridViewDataColumn dataColumn       = column as GridViewDataColumn;
         FilterDescriptor   filterDescriptor = this.GetFilterDescriptor(dataColumn, out isDetached);
         if (filterDescriptor == null)
         {
             return;
         }
         FilterOperator filterOperator = filterDescriptor.Operator;
         bool           flag           = !isDetached && (value == null || object.Equals(value, (object)string.Empty) || object.Equals(value, (object)char.MinValue));
         this.SuspendUpdate();
         if (flag)
         {
             if (!dataColumn.SetFilterDescriptor((FilterDescriptor)null))
             {
                 this.ResumeUpdate();
                 return;
             }
             filterDescriptor = this.GetFilterDescriptor(dataColumn);
         }
         filterDescriptor.Operator = filterOperator;
         GridViewDateTimeColumn viewDateTimeColumn = dataColumn as GridViewDateTimeColumn;
         if (viewDateTimeColumn != null && value is DateTime)
         {
             value = (object)GridViewHelper.ClampDateTime(Convert.ToDateTime(value), viewDateTimeColumn.FilteringMode);
         }
         filterDescriptor.Value = value;
         if (isDetached && value != null)
         {
             this.SetFilterDesriptor(dataColumn, filterDescriptor);
         }
         this.ResumeUpdate();
     }
 }
Example #29
0
 protected override bool ProcessDragOver(Point currentMouseLocation, ISupportDrag dragObject)
 {
     if (dragObject is ColumnChooserItem)
     {
         object             dataContext        = dragObject.GetDataContext();
         GridViewDataColumn gridViewDataColumn = dataContext as GridViewDataColumn;
         if (gridViewDataColumn != null)
         {
             return(!gridViewDataColumn.IsVisible);
         }
         GridViewColumnGroup gridViewColumnGroup = dataContext as GridViewColumnGroup;
         if (gridViewColumnGroup != null)
         {
             return(!gridViewColumnGroup.IsVisible);
         }
     }
     return(false);
 }
Example #30
0
        public int Add(params object[] values)
        {
            if (this.owner.IsVirtualRows)
            {
                return(-1);
            }
            GridViewRowInfo gridViewRowInfo1 = values[0] as GridViewRowInfo;

            if (gridViewRowInfo1 != null)
            {
                this.Add(gridViewRowInfo1);
                return(gridViewRowInfo1.Index);
            }
            if (this.OnRowsChanging(new GridViewCollectionChangingEventArgs(this.owner, NotifyCollectionChangedAction.Add, (object)null, this.Count, -1)))
            {
                return(-1);
            }
            bool notifyUpdates = this.Count == 0;

            this.owner.ListSource.BeginUpdate();
            GridViewRowInfo gridViewRowInfo2 = this.owner.ListSource.AddNew();
            IEditableObject dataBoundItem    = gridViewRowInfo2.DataBoundItem as IEditableObject;

            dataBoundItem?.BeginEdit();
            int num = Math.Min(this.owner.Columns.Count, values.Length);

            for (int index = 0; index < num; ++index)
            {
                GridViewDataColumn column = this.owner.Columns[index];
                gridViewRowInfo2[(GridViewColumn)column] = RadDataConverter.Instance.Parse((IDataConversionInfoProvider)column, values[index]);
            }
            dataBoundItem?.EndEdit();
            this.owner.ListSource.EndUpdate(notifyUpdates);
            ((ICancelAddNew)this.owner.ListSource).EndNew(this.owner.ListSource.Count - 1);
            gridViewRowInfo2.Attach();
            if (this.owner.DataSource == null && this.owner.SortDescriptors.Count > 0)
            {
                this.owner.SortDescriptors.BeginUpdate();
                this.owner.SortDescriptors.EndUpdate(true);
            }
            return(gridViewRowInfo2.Index);
        }