예제 #1
0
        private static int FindInsertLocation(GridViewColumnCollection currentColumns, List <GridViewColumn> originalColumns, GridViewColumn column)
        {
            int insertLocation  = IgnoreVisibilityChange;
            var currentLocation = currentColumns.IndexOf(column);

            if (currentLocation < 0)
            {
                var originalLocation = originalColumns.IndexOf(column);
                if (originalLocation > 0)
                {
                    // try to find where to insert based on neighbors
                    if (originalLocation >= (originalColumns.Count - 1))
                    {
                        // we were the last column, so stay there.
                        insertLocation = -1;
                    }
                    else
                    {
                        insertLocation = originalLocation;
                    }
                }
                else if (originalLocation < 0)
                {
                    throw new InvalidOperationException();
                }
                ////else we were the first column, so stay there
            }
            return(insertLocation);
        }
예제 #2
0
        private int FindIndex(GridViewColumnCollection columns, String id)
        {
            int index = -1;

            for (int i = 0; i < columns.Count; i++)
            {
                GridViewColumnEx col = columns[i] as GridViewColumnEx;
                if (col != null)
                {
                    if (col.Identifier == id)
                    {
                        return(columns.IndexOf(col));
                    }
                }
            }

            return(index);
        }
예제 #3
0
 void Config_Saving(object sender, EventArgs e)
 {
     if (Config != null)
     {
         if (_gridViewColumns != null)
         {
             for (int i = 0; i < _gridViewColumns.Count; i++)
             {
                 var col = _gridViewColumns[i] as GridViewColumnEx;
                 if (col != null)
                 {
                     int width = (int)col.ActualWidth;
                     Update(col.Identifier, _gridViewColumns.IndexOf(col), width);
                 }
             }
         }
     }
 }
        private int FindIndex(GridViewColumnCollection columns, String id)
        {
            int index = -1;

            for (int i = 0; i < columns.Count; i++)
            {
                GridViewColumnEx col = columns[i] as GridViewColumnEx;
                if (col != null)
                {
                    if (col.Identifier == id)
                    {
                        return columns.IndexOf(col);
                    }
                }
            }

            return index;
        }