コード例 #1
0
        public void LoadColumns()
        {
            if (!Config.Columns.ContainsKey(key))
            {
                Config.Columns[key] = new List <ColumnInfo>();
            }

            if (Config.Columns.ContainsKey(key))
            {
                if (Config.ResetColumns.Contains(key))
                {
                    Config.ResetColumns.Remove(key);
                    Config.Columns[key].Clear();
                }

                for (int i = 0; i < Config.Columns[key].Count; i++)
                {
                    var item = Config.Columns[key][i];

                    int index = FindIndex(_gridViewColumns, item.Identifier);
                    if (index >= 0)
                    {
                        int width = item.Width;
                        if (width >= 0)
                        {
                            _gridViewColumns[index].Width = width;
                            if (item.NewIndex >= 0)
                            {
                                if (item.NewIndex < _gridViewColumns.Count)
                                {
                                    _gridViewColumns.Move(index, item.NewIndex);
                                }
                                else
                                {
                                    Config.Columns[key].Remove(item);
                                    i--;
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        internal void ApplyColumnSettings(List <ColumnInfo> newColumns)
        {
            GridViewColumnCollection columns = (lstCatalogMods.View as GridView).Columns;

            for (int i = 0; i < newColumns.Count; i++)
            {
                // get the current index of the column
                int colIndex = columns.ToList().FindIndex(c => ColumnTranslations[((c.Header as GridViewColumnHeader).Content as string)] == newColumns[i].Name);

                // apply the new width if the column does not auto resize
                if (!newColumns[i].AutoResize)
                {
                    columns[colIndex].Width = newColumns[i].Width;
                }

                // move the column to expected index
                columns.Move(colIndex, i);
            }

            RecalculateColumnWidths(); // call this to have auto resize columns recalculate
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: fednep/UV-Outliner
        private void SetupColumns()
        {
            OutlinerDocument document = __Document;
            __OutlinerTreeColumns = (GridViewColumnCollection)this.FindResource("gvcc");

            while (__OutlinerTreeColumns.Count > 0)
                __OutlinerTreeColumns.RemoveAt(__OutlinerTreeColumns.Count - 1);

            for (int i = 0; i < document.ColumnDefinitions.Count; i++)
                AddColumnBinding(document.ColumnDefinitions[i], i);

            if (document.ColumnDefinitions.OrderOnInit != null)
            {
                string[] ids = document.ColumnDefinitions.OrderOnInit.Split(new char[] { ';' });
                for (int i = 0; i < ids.Length; i++)
                {
                    int newViewId = int.Parse(ids[i]);
                    int currentViewId = GetViewColumnId(i);
                    __OutlinerTreeColumns.Move(currentViewId, newViewId);
                }
                document.ColumnDefinitions.OrderOnInit = null;
            }

            OutlinerTree.HeaderVisible = (document.ColumnDefinitions.Count > 1) ? Visibility.Visible : Visibility.Collapsed;
            AdjustColumnSizes();
        }
コード例 #4
0
ファイル: Telerik.cs プロジェクト: allenm84/ml-common
 /// <summary>
 ///
 /// </summary>
 /// <param name="columns"></param>
 /// <param name="name"></param>
 /// <param name="index"></param>
 public static void Move(this GridViewColumnCollection columns, string name, int index)
 {
     columns.Move(columns[name].Index, index);
 }