Ejemplo n.º 1
0
        internal override void SetParent(SplitViewModel parentModel, WindowViewModel parentViewModel)
        {
            base.SetParent(parentModel, parentViewModel);

            Item1?.SetParent(this, parentViewModel);
            Item2?.SetParent(this, parentViewModel);
        }
Ejemplo n.º 2
0
        internal override void SetParent(SplitViewModel parentModel, WindowViewModel parentViewModel)
        {
            base.SetParent(parentModel, parentViewModel);

            foreach (var child in Children)
            {
                child.SetParent(parentModel, parentViewModel);
            }
        }
Ejemplo n.º 3
0
        private void OuterDock(DockEventArgs e)
        {
            var groups   = e.SourceContent.OfType <TabWellModelBase>().ToList();
            var newGroup = new ToolWellModel()
            {
                Dock = (Dock)((int)e.TargetDock - 5)
            };

            foreach (var group in groups)
            {
                var allChildren = group.Children.ToList();
                foreach (var item in allChildren)
                {
                    group.Children.Remove(item);
                    item.IsPinned = false;
                    item.IsActive = false;

                    newGroup.Children.Add(item);
                }
            }

            var newSplit = new SplitViewModel();

            newSplit.Orientation = e.TargetDock == DockTarget.DockLeft || e.TargetDock == DockTarget.DockRight
                ? Orientation.Horizontal
                : Orientation.Vertical;

            if (ParentModel == null)
            {
                ParentViewModel.Content = newSplit;
            }
            else
            {
                ParentModel.Replace(Parent, newSplit);
            }

            if (e.TargetDock == DockTarget.DockTop || e.TargetDock == DockTarget.DockLeft)
            {
                newSplit.Item1     = newGroup;
                newSplit.Item2     = Parent;
                newSplit.Item1Size = new GridLength(e.DesiredSize);
            }
            else
            {
                newSplit.Item1     = Parent;
                newSplit.Item2     = newGroup;
                newSplit.Item2Size = new GridLength(e.DesiredSize);
            }

            newGroup.IsActive     = true;
            newGroup.SelectedItem = newGroup.Children.First();

            e.SourceWindow.Close();
        }
Ejemplo n.º 4
0
        protected override void DockExecuted(DockEventArgs e)
        {
            if (e.TargetDock == DockTarget.Center)
            {
                base.DockExecuted(e);
                return;
            }

            var groups   = e.SourceContent.OfType <TabWellModelBase>().ToList();
            var newGroup = new ToolWellModel()
            {
                Dock = Dock
            };

            foreach (var group in groups)
            {
                var allChildren = group.Children.ToList();
                foreach (var item in allChildren)
                {
                    group.Children.Remove(item);
                    item.IsPinned = false;
                    item.IsActive = false;

                    newGroup.Children.Add(item);
                }
            }

            var newSplit = new SplitViewModel();

            double remainingSize;

            if (e.TargetDock == DockTarget.SplitLeft || e.TargetDock == DockTarget.SplitRight)
            {
                newSplit.Orientation = Orientation.Horizontal;
                remainingSize        = Width - e.DesiredSize;
            }
            else
            {
                newSplit.Orientation = Orientation.Vertical;
                remainingSize        = Height - e.DesiredSize;
            }

            ParentModel.Replace(this, newSplit);
            if (e.TargetDock == DockTarget.SplitTop || e.TargetDock == DockTarget.SplitLeft)
            {
                newSplit.Item1     = newGroup;
                newSplit.Item2     = this;
                newSplit.Item1Size = new GridLength(e.DesiredSize, GridUnitType.Star);
                newSplit.Item2Size = new GridLength(remainingSize, GridUnitType.Star);
            }
            else
            {
                newSplit.Item1     = this;
                newSplit.Item2     = newGroup;
                newSplit.Item1Size = new GridLength(remainingSize, GridUnitType.Star);
                newSplit.Item2Size = new GridLength(e.DesiredSize, GridUnitType.Star);
            }

            newGroup.IsActive     = true;
            newGroup.SelectedItem = newGroup.Children.First();

            e.SourceWindow.Close();
        }
Ejemplo n.º 5
0
 internal virtual void SetParent(SplitViewModel parentModel, WindowViewModel parentViewModel)
 {
     ParentModel     = parentModel;
     ParentViewModel = parentViewModel;
 }