示例#1
0
        /// <summary>
        /// Sets the displayed column settings to the given settings.
        /// </summary>
        /// <param name="columnSettings">A mapping of <see cref="Column"/>s to their visibility state.</param>
        public void SetVisibleColumns(IReadOnlyDictionary <Column, bool> columnSettings)
        {
            Contract.RequiresNotNull(columnSettings, nameof(columnSettings));

            AvailableColumns.Clear();
            VisibleColumns.Clear();
            SelectedAvailableColumns.Clear();
            SelectedVisibleColumns.Clear();

            foreach (Column col in Enum.GetValues(typeof(Column)))
            {
                bool isVisible;
                if (!columnSettings.TryGetValue(col, out isVisible))
                {
                    isVisible = false;
                }

                if (isVisible)
                {
                    VisibleColumns.Add(col);
                }
                else
                {
                    AvailableColumns.Add(col);
                }
            }
        }
示例#2
0
        private void HideColumns()
        {
            // ToArray used to detach the selection collection while we change the lists.
            foreach (var col in SelectedVisibleColumns.ToArray())
            {
                VisibleColumns.Remove(col);
                AvailableColumns.Add(col);
            }

            SelectedVisibleColumns.Clear();
        }