private void UpdateBinding(PropertyArrangeMode arrangeMode, bool contentsOnly = false)
        {
            if (this.items == null)
            {
                return;
            }

            if (arrangeMode == PropertyArrangeMode.Name)
            {
                this.items.ItemsSource = (this.vm.ArrangedEditors.Count > 0) ? this.vm.ArrangedEditors[0].Editors : null;
                if (!contentsOnly)
                {
                    this.vm.ArrangedPropertiesChanged += OnArrangedByNamePropertiesChanged;
                }
            }
            else
            {
                if (!contentsOnly)
                {
                    this.vm.ArrangedPropertiesChanged -= OnArrangedByNamePropertiesChanged;
                }

                this.items.SetBinding(ItemsControl.ItemsSourceProperty, new Binding(nameof(PanelViewModel.ArrangedEditors)));
            }

            if (this.vm != null)
            {
                this.vm.ArrangeMode = arrangeMode;
            }
        }
        public bool GetIsExpanded(PropertyArrangeMode mode)
        {
            if (this.isExpanded == null)
            {
                return(false);
            }

            this.isExpanded.TryGetValue(mode, out bool expanded);
            return(expanded);
        }
        public ArrangeModeViewModel(PropertyArrangeMode arrangeMode, PanelViewModel parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            this.parent = parent;
            this.parent.PropertyChanged += OnParentPropertyChanged;
            ArrangeMode = arrangeMode;
        }
        public void SetIsExpanded(PropertyArrangeMode mode, bool expanded)
        {
            if (this.isExpanded == null)
            {
                if (!expanded)
                {
                    return;
                }

                this.isExpanded = new Dictionary <PropertyArrangeMode, bool> ();
            }

            this.isExpanded[mode] = expanded;
        }
Пример #5
0
        private void OnArrangeModeChanged(PropertyArrangeMode newMode)
        {
            if (this.items == null)
            {
                return;
            }

            Binding itemsSource;

            if (newMode == PropertyArrangeMode.Name)
            {
                itemsSource = new Binding("ArrangedEditors[0]");
            }
            else
            {
                itemsSource = new Binding("ArrangedEditors");
            }

            this.items.SetBinding(ItemsControl.ItemsSourceProperty, itemsSource);
        }