void CreateInternalGrid()
        {
            _internalGrid = new Grid() { FlowDirection = System.Windows.FlowDirection.LeftToRight};
            _internalGrid.SetBinding(Grid.BackgroundProperty, new Binding("Background") { Source = this });

            _internalHost = new LayoutAnchorableControl() { Model = _model, Style = AnchorableStyle };
            _internalHost.SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection") { Source = this });

            KeyboardNavigation.SetTabNavigation(_internalGrid, KeyboardNavigationMode.Cycle);

            _resizer = new LayoutGridResizerControl();

            _resizer.DragStarted += new System.Windows.Controls.Primitives.DragStartedEventHandler(OnResizerDragStarted);
            _resizer.DragDelta += new System.Windows.Controls.Primitives.DragDeltaEventHandler(OnResizerDragDelta);
            _resizer.DragCompleted += new System.Windows.Controls.Primitives.DragCompletedEventHandler(OnResizerDragCompleted);

            if (_side == AnchorSide.Right)
            {
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition(){ Width = new GridLength(_manager.GridSplitterWidth)});
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition(){
                    Width = _model.AutoHideWidth == 0.0 ? new GridLength(_model.AutoHideMinWidth) : new GridLength(_model.AutoHideWidth, GridUnitType.Pixel)});

                Grid.SetColumn(_resizer, 0);
                Grid.SetColumn(_internalHost, 1);

                _resizer.Cursor = Cursors.SizeWE;

                HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            }
            else if (_side == AnchorSide.Left)
            {
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = _model.AutoHideWidth == 0.0 ? new GridLength(_model.AutoHideMinWidth) : new GridLength(_model.AutoHideWidth, GridUnitType.Pixel),
                });
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(_manager.GridSplitterWidth) });

                Grid.SetColumn(_internalHost, 0);
                Grid.SetColumn(_resizer, 1);

                _resizer.Cursor = Cursors.SizeWE;

                HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            }
            else if (_side == AnchorSide.Top)
            {
                _internalGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = _model.AutoHideHeight == 0.0 ? new GridLength(_model.AutoHideMinHeight) : new GridLength(_model.AutoHideHeight, GridUnitType.Pixel),
                });
                _internalGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(_manager.GridSplitterHeight) });

                Grid.SetRow(_internalHost, 0);
                Grid.SetRow(_resizer, 1);

                _resizer.Cursor = Cursors.SizeNS;

                VerticalAlignment = System.Windows.VerticalAlignment.Top;
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            }
            else if (_side == AnchorSide.Bottom)
            {
                _internalGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(_manager.GridSplitterHeight) });
                _internalGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = _model.AutoHideHeight == 0.0 ? new GridLength(_model.AutoHideMinHeight) : new GridLength(_model.AutoHideHeight, GridUnitType.Pixel),
                });

                Grid.SetRow(_resizer, 0);
                Grid.SetRow(_internalHost, 1);

                _resizer.Cursor = Cursors.SizeNS;

                VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            }

            _internalGrid.Children.Add(_resizer);
            _internalGrid.Children.Add(_internalHost);
            _internalHostPresenter.Content = _internalGrid;
        }
        void CreateInternalGrid()
        {
            _internalGrid = new Grid()
            {
                FlowDirection = System.Windows.FlowDirection.LeftToRight
            };
            _internalGrid.SetBinding(Grid.BackgroundProperty, new Binding("Background")
            {
                Source = this
            });


            _internalHost = new LayoutAnchorableControl()
            {
                Model = _model, Style = AnchorableStyle
            };
            _internalHost.SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection")
            {
                Source = this
            });

            KeyboardNavigation.SetTabNavigation(_internalGrid, KeyboardNavigationMode.Cycle);

            _resizer = new LayoutGridResizerControl();

            _resizer.DragStarted   += new System.Windows.Controls.Primitives.DragStartedEventHandler(OnResizerDragStarted);
            _resizer.DragDelta     += new System.Windows.Controls.Primitives.DragDeltaEventHandler(OnResizerDragDelta);
            _resizer.DragCompleted += new System.Windows.Controls.Primitives.DragCompletedEventHandler(OnResizerDragCompleted);

            if (_side == AnchorSide.Right)
            {
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(_manager.GridSplitterWidth)
                });
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = _model.AutoHideWidth == 0.0 ? new GridLength(_model.AutoHideMinWidth) : new GridLength(_model.AutoHideWidth, GridUnitType.Pixel)
                });

                Grid.SetColumn(_resizer, 0);
                Grid.SetColumn(_internalHost, 1);

                _resizer.Cursor = Cursors.SizeWE;

                HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            }
            else if (_side == AnchorSide.Left)
            {
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = _model.AutoHideWidth == 0.0 ? new GridLength(_model.AutoHideMinWidth) : new GridLength(_model.AutoHideWidth, GridUnitType.Pixel),
                });
                _internalGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(_manager.GridSplitterWidth)
                });

                Grid.SetColumn(_internalHost, 0);
                Grid.SetColumn(_resizer, 1);

                _resizer.Cursor = Cursors.SizeWE;

                HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            }
            else if (_side == AnchorSide.Top)
            {
                _internalGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = _model.AutoHideHeight == 0.0 ? new GridLength(_model.AutoHideMinHeight) : new GridLength(_model.AutoHideHeight, GridUnitType.Pixel),
                });
                _internalGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(_manager.GridSplitterHeight)
                });

                Grid.SetRow(_internalHost, 0);
                Grid.SetRow(_resizer, 1);

                _resizer.Cursor = Cursors.SizeNS;

                VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            }
            else if (_side == AnchorSide.Bottom)
            {
                _internalGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(_manager.GridSplitterHeight)
                });
                _internalGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = _model.AutoHideHeight == 0.0 ? new GridLength(_model.AutoHideMinHeight) : new GridLength(_model.AutoHideHeight, GridUnitType.Pixel),
                });

                Grid.SetRow(_resizer, 0);
                Grid.SetRow(_internalHost, 1);

                _resizer.Cursor = Cursors.SizeNS;

                VerticalAlignment   = System.Windows.VerticalAlignment.Bottom;
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            }


            _internalGrid.Children.Add(_resizer);
            _internalGrid.Children.Add(_internalHost);
            _internalHostPresenter.Content = _internalGrid;
        }