internal List <ColumnInfo> GetColumnSettings()
        {
            GridViewColumnCollection columns = (lstCatalogMods.View as GridView).Columns;

            if (columns == null)
            {
                return(null);
            }

            bool hasInvalidColumns = columns.Any(c =>
            {
                ColumnTranslations.TryGetValue((c.Header as GridViewColumnHeader).Content as string, out string translatedName);
                return(string.IsNullOrEmpty(translatedName));
            });

            if (hasInvalidColumns)
            {
                return(null); // exit out if can not translate columns correctly (happens if not initialized in Visual Tree yet and switch languages)
            }

            List <string> columnsThatAutoResize = new List <string>()
            {
                "Name", "Author"
            };

            return(columns.Select(c => new ColumnInfo()
            {
                Name = ColumnTranslations[(c.Header as GridViewColumnHeader).Content as string],
                Width = c.ActualWidth,
                AutoResize = columnsThatAutoResize.Contains(ColumnTranslations[((c.Header as GridViewColumnHeader).Content as string)])
            }).ToList());
        }
Exemple #2
0
        internal List <ColumnInfo> GetColumnSettings()
        {
            GridViewColumnCollection columns = (lstMods.View as GridView).Columns;

            if (columns == null)
            {
                return(null);
            }

            List <string> columnsThatAutoResize = new List <string>()
            {
                "Name", "Author"
            };

            return(columns.Select(c => new ColumnInfo()
            {
                Name = (c.Header as GridViewColumnHeader).Content as string,
                Width = c.ActualWidth,
                AutoResize = columnsThatAutoResize.Contains((c.Header as GridViewColumnHeader).Content as string)
            }).ToList());
        }
Exemple #3
0
 /// <summary>
 /// キーを指定してソートする。主に初期化用。キーがColumsに存在していなければ何もしない。
 /// 実際にソートされるとTRUEが返る。
 /// </summary>
 public bool SortByMultiHeaderWithKey(IList itemList0, GridViewColumnCollection Columns, string Key, bool directionSet = false, ListSortDirection direction = ListSortDirection.Ascending)
 {
     return(_sortByMultiHeader(itemList0, Columns.Select(item => (GridViewColumnHeader)item.Header)
                               .FirstOrDefault(header => getHeaderString(header) == Key), directionSet, direction));
 }