Ejemplo n.º 1
0
        protected override void OnTemplateContractAttached()
        {
            base.OnTemplateContractAttached();

            ItemsHost.ColumnDefinitions.Clear();
            ItemsHost.RowDefinitions.Clear();
            ItemsHost.ColumnDefinitions.Add(new ColumnDefinition());
            ItemsHost.RowDefinitions.Add(new RowDefinition());

            foreach (var item in Items)
            {
                AddGridDefinitions(item);
            }

            _splitterConstraintHelper.Grid = ItemsHost;

            // Enqueue splitter measurements
            var columnSplitter = new DockGridSplitter {
                Opacity = 0, IsHitTestVisible = false
            };
            var rowSplitter = new DockGridSplitter {
                Opacity = 0, IsHitTestVisible = false
            };

            SetResizeDirection(columnSplitter, GridResizeDirection.Columns);
            SetResizeDirection(rowSplitter, GridResizeDirection.Rows);

            ItemsHost.Children.Add(columnSplitter);
            ItemsHost.Children.Add(rowSplitter);

            columnSplitter.Loaded += OnMeasureSplitterLoaded;
            rowSplitter.Loaded    += OnMeasureSplitterLoaded;

            InvalidateItemsArrange();
        }
Ejemplo n.º 2
0
        protected override void OnItemAdded(DockItem item)
        {
            var splitter = new DockGridSplitter();

            splitter.SetZIndex(short.MaxValue);
            _itemSplitterDictionary[item] = splitter;
            splitter.LostMouseCapture    += OnSplitterLostMouseCapture;
            _splitterConstraintHelper.AddSplitter(splitter);

            AddGridDefinitions(item);

            InvalidateItemsArrange();
        }