/// <summary></summary>
        /// <param name="newValue"></param>
        /// <param name="oldValue"></param>
        protected virtual void OnCommandsChanged(PpsUICommandCollection newValue, PpsUICommandCollection oldValue)
        {
            if (oldValue != null)
            {
                oldValue.CollectionChanged -= Commands_CollectionChanged;
            }
            if (newValue != null)
            {
                newValue.CollectionChanged += Commands_CollectionChanged;
            }

            UpdateCommands();
        }         // proc OnCommandsChanged
Exemple #2
0
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

        #region -- Ctor/Dtor --------------------------------------------------------------

        /// <summary></summary>
        public PpsGenericWpfControl()
            : base()
        {
            // initialize commands
            var commands = new PpsUICommandCollection
            {
                AddLogicalChildHandler    = AddLogicalChild,
                RemoveLogicalChildHandler = RemoveLogicalChild
            };

            SetValue(commandsPropertyKey, commands);

            Focusable = false;
        }         // ctor
        public PpsNavigatorDataModel(PpsNavigatorPane pane, PpsUICommandCollection globalCommands, PpsUICommandCollection listCommands, PpsUICommandCollection itemCommands)
            : base(pane.PaneHost.PaneManager.Shell)
        {
            this.pane = pane ?? throw new ArgumentNullException(nameof(pane));

            this.globalCommands = globalCommands ?? throw new ArgumentNullException(nameof(globalCommands));
            this.listCommands   = listCommands ?? throw new ArgumentNullException(nameof(listCommands));
            this.itemCommands   = itemCommands ?? throw new ArgumentNullException(nameof(itemCommands));

            // view source
            viewSource = new CollectionViewSource {
                Source = Environment.Views
            };
            viewSource.Filter += FilterView;
            viewSource.SortDescriptions.Add(new SortDescription(nameof(PpsViewDefinition.DisplayName), ListSortDirection.Ascending));
            viewSource.View.MoveCurrentTo(null);

            // actions
            Environment.Actions.CollectionChanged += Actions_CollectionChanged;
            RefreshItems();
            RefreshActions();
        }         // ctor