Exemple #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);
                }
            }
        }