コード例 #1
0
        protected override void OnContentChanged(object oldContent, object newContent)
        {
            base.OnContentChanged(oldContent, newContent);

            if (newContent != null)
            {
                DockTarget.SetDockContainer(newContent as DependencyObject, this);
            }
        }
コード例 #2
0
        public void SuppressCloseEvent()
        {
            object container = DockTarget.GetDockContainer(this);

            if (container is Window)
            {
                (container as Window).Closed -= DockContent_Closed;
            }
            else if (container is DockedWindow)
            {
                (container as DockedWindow).Closed -= DockContent_Closed;
            }
        }
コード例 #3
0
        public void Close()
        {
            object dockContainer = DockTarget.GetDockContainer(this);

            if (dockContainer is UndockedWindow)
            {
                ((UndockedWindow)dockContainer).Close();
            }
            else if (dockContainer is DockedWindow)
            {
                ((DockedWindow)dockContainer).Close();
            }
        }
コード例 #4
0
        private void DockContent_Loaded(object sender, RoutedEventArgs e)
        {
            object container = DockTarget.GetDockContainer(this);

            if (container is Window)
            {
                Window window = container as Window;
                window.Closed -= DockContent_Closed;
                window.Closed += DockContent_Closed;
            }
            else if (container is DockedWindow)
            {
                DockedWindow docked = container as DockedWindow;
                docked.Closed -= DockContent_Closed;
                docked.Closed += DockContent_Closed;
            }
        }
コード例 #5
0
        protected override void OnContentChanged(object oldContent, object newContent)
        {
            base.OnContentChanged(oldContent, newContent);

            if (newContent != null)
            {
                DockTarget.SetDockContainer(newContent as DependencyObject, this);

                DockContent content = newContent as DockContent;

                if (!double.IsNaN(content.Width))
                {
                    Width         = content.Width;
                    content.Width = double.NaN;
                }

                if (!double.IsNaN(content.Height))
                {
                    //Height = content.Height;
                    content.Height = double.NaN;
                }
            }
        }