当前位置: 首页>>代码示例>>C#>>正文


C# AvalonDock.DockablePane类代码示例

本文整理汇总了C#中AvalonDock.DockablePane的典型用法代码示例。如果您正苦于以下问题:C# DockablePane类的具体用法?C# DockablePane怎么用?C# DockablePane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DockablePane类属于AvalonDock命名空间,在下文中一共展示了DockablePane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FlyoutDockablePane

        public FlyoutDockablePane(DockableContent content)
        {
            _referencedPane = content.ContainerPane as DockablePane;
            _manager = _referencedPane.GetManager();

            //save current content position in container pane
            _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content);
            Anchor = _referencedPane.Anchor;

            //SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width));
            //SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height));

            this.Style = _referencedPane.Style;

            //remove content from container pane
            //and add content to my temporary pane
            _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane);
            this.Items.Add(content);

            //select the single content in this pane
            SelectedItem = this.Items[0];
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:22,代码来源:FlyoutDockablePane.cs

示例2: DropInto

        internal void DropInto(DockablePane paneDragged, DockablePane paneToDropInto)
        {
            //transfer tha contents of dragged pane (conatined in a FloatingWindow)
            //to the pane which user select, taking care of setting contents state
            //to Dock (using Dock() method of class DockablePane).
            while (paneDragged.Items.Count > 0)
            {
                ManagedContent contentToTransfer = paneDragged.RemoveContent(0);
                paneToDropInto.Items.Add(contentToTransfer);

                DockableContent dockContentToTransfer = contentToTransfer as DockableContent;

                if (dockContentToTransfer != null)
                    dockContentToTransfer.SetStateToDock();
            }

            paneToDropInto.SelectedIndex = paneToDropInto.Items.Count - 1;
            //paneToDropInto.Focus();
        }
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:19,代码来源:DockingManager.cs

示例3: Drag

 internal void Drag(DockablePane dockablePane, Point point, Point offset)
 {
     if (CaptureMouse())
     {
         var floatingWindow = new DockableFloatingWindow(this);
         floatingWindow.Content = dockablePane;
         floatingWindow.Owner = Window.GetWindow(this);
         Drag(floatingWindow, point, offset);
     }
 }
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:10,代码来源:DockingManager.cs

示例4: switch


//.........这里部分代码省略.........
     this.DrawPolygonBtn.Checked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Checked);
     
     #line default
     #line hidden
     
     #line 60 "..\..\..\MainWindow.xaml"
     this.DrawPolygonBtn.Unchecked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Unchecked);
     
     #line default
     #line hidden
     return;
     case 32:
     this.RibbonDlgMgrGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target));
     return;
     case 33:
     this.ToggleDlgBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 66 "..\..\..\MainWindow.xaml"
     this.ToggleDlgBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleDlgBtn_Click);
     
     #line default
     #line hidden
     return;
     case 34:
     this.RibbonSpeechRecGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target));
     return;
     case 35:
     this.ToggleSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 69 "..\..\..\MainWindow.xaml"
     this.ToggleSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleSpeechBtn_Click);
     
     #line default
     #line hidden
     return;
     case 36:
     this.SimSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 70 "..\..\..\MainWindow.xaml"
     this.SimSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.SimSpeechBtn_Click);
     
     #line default
     #line hidden
     return;
     case 37:
     this.dockManager = ((AvalonDock.DockingManager)(target));
     return;
     case 38:
     this.LayersPanel = ((AvalonDock.DockableContent)(target));
     return;
     case 39:
     this.tocGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 40:
     
     #line 84 "..\..\..\MainWindow.xaml"
     ((AvalonDock.DocumentPane)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.DocumentPane_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 41:
     this.MapPanel = ((AvalonDock.DocumentContent)(target));
     return;
     case 42:
     this.mapGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 43:
     this.LayoutPanel = ((AvalonDock.DocumentContent)(target));
     return;
     case 44:
     this.layoutGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 45:
     this.KinectCtrlPanel = ((AvalonDock.DockablePane)(target));
     return;
     case 46:
     this.ColorDisplayPanel = ((AvalonDock.DockableContent)(target));
     return;
     case 47:
     this.colorDisplay = ((System.Windows.Controls.Image)(target));
     return;
     case 48:
     this.skeletonCanvas = ((System.Windows.Controls.Canvas)(target));
     return;
     case 49:
     this.DepthDisplayPanel = ((AvalonDock.DockableContent)(target));
     return;
     case 50:
     this.depthDisplay = ((System.Windows.Controls.Image)(target));
     return;
     case 51:
     this.DevCtrlPanel = ((AvalonDock.DockablePane)(target));
     return;
     case 52:
     this.statusTB = ((System.Windows.Controls.TextBlock)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:cdbean,项目名称:CAGA,代码行数:101,代码来源:MainWindow.g.i.cs

示例5: CreateOrUnhideDockableContent

        private void CreateOrUnhideDockableContent(ContentTypes contentType, string title, string viewPropertyName, object parent)
        {
            if (!this.dockableContents.Keys.Contains(contentType))
            {
                DockableContent dockableContent = new DockableContent();

                ContentControl contentControl = new ContentControl();

                dockableContent.IsCloseable = true;
                dockableContent.HideOnClose = false;

                dockableContent.Title = title;

                dockableContent.Content = contentControl;

                if (parent is ResizingPanel)
                {
                    DockablePane dockablePane = new DockablePane();
                    dockablePane.Items.Add(dockableContent);
                    ResizingPanel resizingPanel = parent as ResizingPanel;

                    switch (contentType)
                    {
                        case ContentTypes.PropertyInspector:
                            resizingPanel.Children.Add(dockablePane);
                            ResizingPanel.SetResizeWidth(dockablePane, new GridLength(300));
                            break;
                        case ContentTypes.Outline:
                            resizingPanel.Children.Insert(1, dockablePane);
                            ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250));
                            break;
                        case ContentTypes.Toolbox:
                            resizingPanel.Children.Insert(0, dockablePane);
                            ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250));
                            break;
                    }
                }
                else if (parent is DockablePane)
                {
                    DockablePane dockablePane = parent as DockablePane;
                    dockablePane.Items.Add(dockableContent);
                    if (dockablePane.Parent == null)
                    {
                        this.verticalResizingPanel.Children.Add(dockablePane);
                    }
                }

                Binding dataContextBinding = new Binding(viewPropertyName);
                dockableContent.SetBinding(DockableContent.DataContextProperty, dataContextBinding);

                Binding contentBinding = new Binding(".");
                contentControl.SetBinding(ContentControl.ContentProperty, contentBinding);

                this.dockableContents[contentType] = dockableContent;

                dockableContent.Closed += delegate(object sender, EventArgs args)
                {
                    contentControl.Content = null;
                    this.dockableContents[contentType].DataContext = null;
                    this.dockableContents.Remove(contentType);
                };
            }
            else
            {
                if (this.dockableContents[contentType].State == DockableContentState.Hidden)
                {
                    this.dockableContents[contentType].Show();
                }
            }
        }
开发者ID:yinqunjun,项目名称:WorkflowFoundation.40.45.Development,代码行数:70,代码来源:MainWindowViewModel.cs

示例6: Anchor

        /// <summary>
        /// Anchor a dockable pane to a border
        /// </summary>
        /// <param name="paneToAnchor"></param>
        /// <param name="anchor"></param>
        public void Anchor(DockablePane paneToAnchor, AnchorStyle anchor)
        {
            //ensure that content property is not empty
            EnsureContentNotEmpty();

            if (Content == null)
                return;

            //remove the pane from its original children collection
            FrameworkElement parentElement = paneToAnchor.Parent as FrameworkElement;

            if (anchor == AnchorStyle.None)
                anchor = AnchorStyle.Right;

            //Change anchor border according to FlowDirection
            if (FlowDirection == FlowDirection.RightToLeft)
            {
                if (anchor == AnchorStyle.Right)
                    anchor = AnchorStyle.Left;
                else if (anchor == AnchorStyle.Left)
                    anchor = AnchorStyle.Right;
            }

            //parentElement should be a DockingManager or a ResizingPanel
            if (parentElement is ContentControl)
            {
                ((ContentControl)parentElement).Content = null;
            }

            //and insert in the top level panel if exist
            ResizingPanel toplevelPanel = Content as ResizingPanel;

            if (toplevelPanel != null && toplevelPanel.Children.Count == 0)
            {
                Content = null;
                toplevelPanel = null;
            }

            Orientation requestedOrientation =
                (anchor == AnchorStyle.Bottom || anchor == AnchorStyle.Top) ? Orientation.Vertical : Orientation.Horizontal;

            //if toplevel panel contains only one child then just override the orientation
            //as requested
            if (toplevelPanel != null && toplevelPanel.Children.Count == 1)
                toplevelPanel.Orientation = requestedOrientation;

            if (toplevelPanel == null ||
                toplevelPanel.Orientation != requestedOrientation)
            {
                //if toplevel panel doesn't exist or it has not the correct orientation
                //we have to create a new one and set it as content of docking manager
                toplevelPanel = new ResizingPanel();
                toplevelPanel.Orientation = requestedOrientation;

                FrameworkElement contentElement = Content as FrameworkElement;

                _allowRefreshContents = false;
                Content = null;

                if (anchor == AnchorStyle.Left ||
                    anchor == AnchorStyle.Top)
                {
                    toplevelPanel.Children.Add(paneToAnchor);
                    toplevelPanel.InsertChildRelativeTo(contentElement, paneToAnchor, true);
                }
                else
                {
                    toplevelPanel.Children.Add(paneToAnchor);
                    toplevelPanel.InsertChildRelativeTo(contentElement, paneToAnchor, false);
                }

                _allowRefreshContents = true;
                Content = toplevelPanel;
            }
            else
            {

                //here we have a docking manager content with the right orientation
                //so we have only to insert new child at correct position
                if (anchor == AnchorStyle.Left ||
                    anchor == AnchorStyle.Top)
                {
                    //add new child before first one (prepend)
                    toplevelPanel.InsertChildRelativeTo(paneToAnchor, toplevelPanel.Children[0] as FrameworkElement, false);
                }
                else
                {
                    //add new child after last one (append)
                    toplevelPanel.InsertChildRelativeTo(paneToAnchor, toplevelPanel.Children[toplevelPanel.Children.Count - 1] as FrameworkElement, true);
                }
            }

            //Refresh anchor style
            DockablePane paneToAnchorAsDockablePane = paneToAnchor as DockablePane;

//.........这里部分代码省略.........
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:101,代码来源:DockingManager.cs

示例7: RestoreLayout

        /// <summary>
        /// Internal main restore layout method
        /// </summary>
        /// <param name="doc">Document Xml from which restore layout</param>
        void RestoreLayout(XmlDocument doc)
        {
            if (!_isControlLoaded)
                throw new InvalidOperationException("Unable to deserialize a docking layout while DockingManager control is unloaded");

            if (doc.DocumentElement == null ||
                doc.DocumentElement.Name != "DockingManager")
            {
                Debug.Assert(false, "Layout file hasn't a valid structure!");
                throw new InvalidOperationException("Layout file had not a valid structure!");
            }

            if (doc.DocumentElement.GetAttribute("version") != layoutFileVersion)
                throw new FileFormatException("Unsupported layout file version");

            if (doc.DocumentElement.ChildNodes.Count != 3 ||
                (doc.DocumentElement.ChildNodes[0].Name != "ResizingPanel" && doc.DocumentElement.ChildNodes[0].Name != "DocumentPane") ||
                doc.DocumentElement.ChildNodes[1].Name != "Hidden" ||
                doc.DocumentElement.ChildNodes[2].Name != "Windows")
            {
                Debug.Assert(false, "Layout file hasn't a valid structure!");
                throw new InvalidOperationException("Layout file hasn't a valid structure!");
            }

            //Hide temp windows
            HideFlyoutWindow();
            HideNavigatorWindow();
            //HideDocumentNavigatorWindow();

            RestoringLayout = true;

            //show all auto hidden panes
            var panesAutoHidden = DockableContents.Where(c => c.State == DockableContentState.AutoHide).Select(c => c.ContainerPane).Distinct();
            foreach (DockablePane pane in panesAutoHidden)
                pane.ToggleAutoHide();

            DockableContent[] actualContents = DockableContents.ToArray();
            DocumentContent[] actualDocuments = Documents.ToArray();

            //first detach all my actual contents
            this.Content = null;
            this.ActiveContent = null;
            this.ActiveDocument = null;

            //restore main panel
            XmlElement rootElement = doc.DocumentElement.ChildNodes[0] as XmlElement;
            DocumentPane mainDocumentPane = null;
            this.Content = RestoreLayout(rootElement, actualContents, actualDocuments, ref mainDocumentPane);
            MainDocumentPane = mainDocumentPane;

            //restore hidden contents
            foreach (XmlElement hiddenContentElement in doc.DocumentElement.ChildNodes[1].ChildNodes)
            {
                var hiddenContentName = hiddenContentElement.GetAttribute("Name");

                var hiddenContent = actualContents.FirstOrDefault(c => c.Name == hiddenContentName &&
                    c.State != DockableContentState.Hidden);

                if (hiddenContent != null)
                {
                    Hide(hiddenContent);
                    hiddenContent.RestoreLayout(hiddenContentElement);
                }
            }

            //restore floating windows
            foreach (XmlElement flWindowElement in doc.DocumentElement.ChildNodes[2].ChildNodes)
            {
                if (flWindowElement.ChildNodes.Count != 1)
                    continue;//handles invalid layouts structures

                bool isDockableWindow = XmlConvert.ToBoolean(flWindowElement.GetAttribute("IsDockableWindow"));
                Point location = new Point(XmlConvert.ToDouble(flWindowElement.GetAttribute("Left")), XmlConvert.ToDouble(flWindowElement.GetAttribute("Top")));
                Size size = new Size(XmlConvert.ToDouble(flWindowElement.GetAttribute("Width")), XmlConvert.ToDouble(flWindowElement.GetAttribute("Height")));

                XmlElement paneElement = flWindowElement.ChildNodes[0] as XmlElement;

                DockablePane paneForFloatingWindow = new DockablePane();
                if (paneElement.HasAttribute("ResizingWidth"))
                    ResizingPanel.SetResizeWidth(paneForFloatingWindow, (GridLength)GLConverter.ConvertFromInvariantString(paneElement.GetAttribute("ResizeWidth")));
                if (paneElement.HasAttribute("ResizingHeight"))
                    ResizingPanel.SetResizeHeight(paneForFloatingWindow, (GridLength)GLConverter.ConvertFromInvariantString(paneElement.GetAttribute("ResizeHeight")));
                paneForFloatingWindow.Anchor = (AnchorStyle)Enum.Parse(typeof(AnchorStyle), paneElement.GetAttribute("Anchor"));

                DockableContent contentToTransfer = null;
                foreach (XmlElement contentElement in paneElement.ChildNodes)
                {
                    #region Find the content to transfer
                    string contentToFindName = contentElement.GetAttribute("Name");
                    contentToTransfer = actualContents.FirstOrDefault(c => c.Name == contentToFindName);

                    if (contentToTransfer == null &&
                        DeserializationCallback != null)
                    {
                        DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentToFindName);
                        DeserializationCallback(this, e);
//.........这里部分代码省略.........
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:101,代码来源:DockingManager.cs

示例8: RemovePaneFromTabGroups

        /// <summary>
        /// Remove a pane from border tab groups
        /// </summary>
        /// <param name="pane">Pane to remove</param>
        /// <returns>True if pane was removed, false otherwise</returns>
        bool RemovePaneFromTabGroups(DockablePane paneToRemove)
        {
            foreach (Panel anchorTabPanel in _anchorTabPanels)
            {
                foreach (DockablePaneAnchorTabGroup group in anchorTabPanel.Children)
                {
                    if (group.ReferencedPane == paneToRemove)
                    {
                        anchorTabPanel.Children.Remove(group);
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:21,代码来源:DockingManager.cs

示例9: activatePlugin

        public bool activatePlugin( string PluginFile, ref List<IPlugin> Plugins )
        {
            Assembly asm = null;

            try
            {
                // FIXME: check only for valid .net assemblies with manifest
                asm = Assembly.LoadFile( PluginFile );

                if ( asm == null )
                    return false;
            }
            catch ( Exception e )
            {
            }

            Type PluginClass = null;
            int i = 0;

            // iterate through all types in assembly

            // !! FIXME: for debug only

            //foreach ( Type type in asm.GetTypes() )
            //{
            //PluginClass = type;

            // !! FIXME: for debug only
            //if ( PluginClass is IRenderEngine )
            // if a rendering able plugin was found
            //{
            try
            {
                // create an instance of rendering plugin
                //IRenderEngine tplugin = Activator.CreateInstance( PluginClass ) as IRenderEngine;

                IRenderEngine tplugin = (IRenderEngine) new RayCaster( dsm, anim_man );

                ModelOrientationControl orientationControl = new ModelOrientationControl(tplugin,wm);
                var dockPane = new DockablePane();

                dockPane.Items.Add( new DockableContent()
                {
                    Name = "orientationContent",
                    Title = "Orientation",
                    Content = orientationControl
                } );

                var resHorizontalPanel = new ResizingPanel()
                {
                    Orientation = Orientation.Horizontal
                };

                resHorizontalPanel.Children.Add( dockPane );

                //resHorizontalPanel.Children.Add( logDockPane);
                this.wm.DockingManager.Content = resHorizontalPanel;

                var ccc = this.wm.DockingManager.Content;

                if ( tplugin != null )
                    Plugins.Add( tplugin );

                // setup a new RenderWindow
                RenderWindow renderWindow = new RenderWindow();
                renderWindow.RenderEngine = tplugin;

                //var renderingDataset = dsm.getRenderingDatasetRef();
                //renderWindow.SetRenderingDataset( ref renderingDataset );

                OpenGLWindow glWindow = new OpenGLWindow();
                glWindow.SetRenderingMethod( tplugin );

                renderWindow.GlWindows.Add( glWindow );
                this.rwm.RenderWindows.Add( renderWindow );

                // setup marching cubes opengl window
                IRenderEngine marchingCubesPlugin = (IRenderEngine) new MarchingCubes( dsm );

                if ( marchingCubesPlugin != null )
                    Plugins.Add( marchingCubesPlugin );

                // setup a new RenderWindow
                RenderWindow renderWindow2 = new RenderWindow();
                renderWindow2.RenderEngine = marchingCubesPlugin;

                OpenGLWindow glWindow2 = new OpenGLWindow();
                glWindow2.SetRenderingMethod( marchingCubesPlugin );

                renderWindow2.GlWindows.Add( glWindow2 );
                //this.rwm.RenderWindows.Add(renderWindow2);

                wm.Register( this.rwm );
            }
            //}

            catch ( Exception e )
            {
                MessageBox.Show( "Shit happened during plugin registration: " + PluginFile + e.Message );
            }
//.........这里部分代码省略.........
开发者ID:msup,项目名称:RayEngine,代码行数:101,代码来源:PluginManager.cs

示例10: ClonePane

        //protected override void OnClosed(EventArgs e)
        //{
        //    base.OnClosed(e);
        //    DockableContent[] cntsToClose = new DockableContent[HostedPane.Items.Count];
        //    HostedPane.Items.CopyTo(cntsToClose, 0);
        //    foreach (DockableContent cntToClose in cntsToClose)
        //    {
        //        //HostedPane.CloseOrHide(HostedPane.Items[0] as DockableContent, ForcedClosing);
        //        cntToClose.CloseOrHide(ForcedClosing);
        //    }
        //    Manager.UnregisterFloatingWindow(this);
        //}
        public override Pane ClonePane()
        {
            DockablePane paneToAnchor = new DockablePane();

            ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height));

            //if (HostedPane.Style != null)
            //    paneToAnchor.Style = HostedPane.Style;

            int selectedIndex = HostedPane.SelectedIndex;

            //transfer contents from hosted pane in the floating window and
            //the new created dockable pane
            while (HostedPane.Items.Count > 0)
            {
                paneToAnchor.Items.Add(
                    HostedPane.RemoveContent(0));
            }

            paneToAnchor.SelectedIndex = selectedIndex;

            return paneToAnchor;
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:35,代码来源:DockableFloatingWindow.cs

示例11: Redock

        protected override void Redock()
        {
            if (_previousPane != null)
            {
                if (_previousPane.GetManager() == null)
                {
                    DockablePane newContainerPane = new DockablePane();
                    newContainerPane.Items.Add(HostedPane.RemoveContent(0));
                    newContainerPane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty));
                    newContainerPane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty));

                    if (_previousPane.Style != null)
                        newContainerPane.Style = _previousPane.Style;
                    
                    Manager.Anchor(newContainerPane, ((DockablePane)_previousPane).Anchor);
                }
                else
                {
                    if (_arrayIndexPreviousPane > _previousPane.Items.Count)
                        _arrayIndexPreviousPane = _previousPane.Items.Count;

                    DockableContent currentContent = HostedPane.Items[0] as DockableContent;
                    _previousPane.Items.Insert(_arrayIndexPreviousPane, HostedPane.RemoveContent(0));
                    _previousPane.SelectedIndex = _arrayIndexPreviousPane;
                    currentContent.SetStateToDock();

                }
                this.Close();
            } 
            
            base.Redock();
        }
开发者ID:Reticulatas,项目名称:AvalonDock,代码行数:32,代码来源:DockableFloatingWindow.cs

示例12: DockableFloatingWindow

        public DockableFloatingWindow(DockingManager manager, DockablePane dockablePane)
            : this(manager)
        {
            //create a new temporary pane
            FloatingDockablePane pane = new FloatingDockablePane(this);

            //setup window size
            ManagedContent selectedContent = dockablePane.SelectedItem as ManagedContent;

            if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty)
                selectedContent.FloatingWindowSize = new Size(dockablePane.ActualWidth, dockablePane.ActualHeight);

            if (selectedContent != null)
            {
                Width = selectedContent.FloatingWindowSize.Width;
                Height = selectedContent.FloatingWindowSize.Height;
                this.ResizeMode = selectedContent.FloatingResizeMode;
            }
            else
            {
                Width = dockablePane.ActualWidth;
                Height = dockablePane.ActualHeight;
            }

            //transfer the style from the original dockablepane
            pane.Style = dockablePane.Style;

            //Width = dockablePane.ActualWidth;
            //Height = dockablePane.ActualHeight;

            ////save current content position in container pane
            //pane.SetValue(ResizingPanel.ResizeWidthProperty, dockablePane.GetValue(ResizingPanel.ResizeWidthProperty));
            //pane.SetValue(ResizingPanel.ResizeHeightProperty, dockablePane.GetValue(ResizingPanel.ResizeHeightProperty));

            int selectedIndex = dockablePane.SelectedIndex;

            //remove contents from container pane and insert in hosted pane
            while (dockablePane.Items.Count > 0)
            {
                ManagedContent content = dockablePane.RemoveContent(0);

                //add content to my temporary pane
                pane.Items.Add(content);
            }

            //let templates access this pane
            HostedPane = pane;
            HostedPane.SelectedIndex = selectedIndex;

            //Change state on contents
            IsDockableWindow = true;
        }
开发者ID:Reticulatas,项目名称:AvalonDock,代码行数:52,代码来源:DockableFloatingWindow.cs

示例13: ShowPad

 /// <summary>
 /// Shows a pad.  If it hasn't been shown before, it shows it
 /// docked to the right side.  Otherwise it restores it to the
 /// previous place that it was before hiding.  Doesn't work
 /// correctly for floating panes (yet).
 /// </summary>
 /// <param name="pad"></param>
 public void ShowPad(IPad pad)
 {
     if (!m_padLookup.ContainsKey(pad))
     {
         DockableContent content = new DockableContent();
         setManagedContentProperties(pad, content);
         m_padLookup.Add(pad, content);
         DockablePane dp = new DockablePane();
         dp.Items.Add(content);
         m_resizingPanel.Children.Add(dp);
         pad.PropertyChanged += new PropertyChangedEventHandler(pad_PropertyChanged);
         content.GotFocus += new RoutedEventHandler(pad.OnGotFocus);
         content.LostFocus += new RoutedEventHandler(pad.OnLostFocus);
     }
     m_padLookup[pad].Show(DockManager);
 }
开发者ID:EdWeller,项目名称:SoapboxSnap,代码行数:23,代码来源:LayoutManager.cs

示例14: MainWindowViewModel

        public MainWindowViewModel(DockingManager dockingManager, ResizingPanel horizontalResizingPanel, ResizingPanel verticalResizingPanel, DockablePane tabsPane)
        {
            this.dockingManager = dockingManager;

            dockingManager.ActiveDocumentChanged += delegate(object sender, EventArgs args)
            {
                this.UpdateViews();
            };

            this.toolboxControl = new ToolboxControl();
            this.InitialiseToolbox();

            this.horizontalResizingPanel = horizontalResizingPanel;
            this.verticalResizingPanel = verticalResizingPanel;

            this.tabsPane = tabsPane;

            this.dockableContents = new Dictionary<ContentTypes, DockableContent>();
            this.ViewToolbox();

            string disableDebugViewOutputValue = ConfigurationManager.AppSettings["DisableDebugViewOutput"];
            if (!string.IsNullOrEmpty(disableDebugViewOutputValue))
            {
                this.disableDebugViewOutput = bool.Parse(disableDebugViewOutputValue);
            }
        }
开发者ID:yinqunjun,项目名称:WorkflowFoundation.40.45.Development,代码行数:26,代码来源:MainWindowViewModel.cs

示例15: Show

        /// <summary>
        /// Show a dockable content in its container with a desidered state
        /// </summary>
        /// <param name="content">Content to show</param>
        /// <param name="desideredState">State desidered</param>
        /// <param name="desideredAnchor">Border to which anchor the newly created container pane</param>
        /// <remarks></remarks>
        internal void Show(DockableContent content, DockableContentState desideredState, AnchorStyle desideredAnchor)
        {
            Debug.WriteLine(string.Format("Show Content={0}, desideredState={1}, desideredAnchor={2}", content.Name, desideredState, desideredAnchor));

            #region Dockable content

            if (desideredState == DockableContentState.Hidden)//??!!show hidden?
                Hide(content);

            if (content.State == DockableContentState.AutoHide)
            {
                //first redock the content
                (content.ContainerPane as DockablePane).ToggleAutoHide();
                //then show it as desidered
                Show(content, desideredState, desideredAnchor);
            }
            else if (content.State == DockableContentState.Docked ||
                content.State == DockableContentState.Document ||
                content.State == DockableContentState.None)
            {
                if (content.ContainerPane == null ||
                    content.State == DockableContentState.None)
                {
                    //Problem!? try to rescue
                    if (content.State == DockableContentState.Docked ||
                        content.State == DockableContentState.None)
                    {
                        //find the the pane which the desidered anchor style
                        //DockablePane foundPane = this.FindChildDockablePane(desideredAnchor != AnchorStyle.None ? desideredAnchor : AnchorStyle.Right);
                        //first search for a pane with other contents (avoiding empty panes which are containers for hidden contents)
                        ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).IsDocked);

                        if (itemFound == null)//search for all panes (even empty)
                            itemFound = new LogicalTreeAdapter(this).Descendants().FirstOrDefault(el => el.Item is DockablePane && (el.Item as DockablePane).Anchor == desideredAnchor && (el.Item as DockablePane).Items.Count == 0);

                        DockablePane foundPane = itemFound != null ? itemFound.Item as DockablePane : null;

                        if (foundPane != null)
                        {
                            content.SetStateToDock();
                            foundPane.Items.Add(content);
                            var containerPanel = foundPane.Parent as ResizingPanel;
                            if (containerPanel != null)
                                containerPanel.InvalidateMeasure();
                        }
                        else
                        {
                            //if no suitable pane was found create e new one on the fly
                            if (content.ContainerPane != null)
                            {
                                content.ContainerPane.RemoveContent(content);
                            }

                            DockablePane pane = new DockablePane();
                            pane.Items.Add(content);
                            Anchor(pane, desideredAnchor);
                        }
                    }
                    else
                    {
                        //add to main document pane
                        MainDocumentPane.Items.Add(content);
                    }

                }

                if (content.ContainerPane.GetManager() == null)
                {
                    //disconnect the parent pane from previous panel
                    //((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane);
                    if (content.ContainerPane.Parent != null)
                    {
                        ((Panel)content.ContainerPane.Parent).Children.Remove(content.ContainerPane);
                    }

                    Anchor(content.ContainerPane as DockablePane, desideredAnchor);
                }

                if (desideredState == DockableContentState.DockableWindow ||
                     desideredState == DockableContentState.FloatingWindow)
                {
                    var floatingWindow = new DockableFloatingWindow(this);
                    floatingWindow.Content = content;

                    var mainWindow = Window.GetWindow(this);
                    if (mainWindow.IsVisible)
                        floatingWindow.Owner = mainWindow;

                    //floatingWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    //if (content.Content != null)
                    //{
                    //    floatingWindow.Width = Math.Min(((FrameworkElement)content.Content).ActualWidth, ResizingPanel.GetResizeWidth(content.ContainerPane));
                    //    floatingWindow.Height = Math.Min(((FrameworkElement)content.Content).ActualHeight, ResizingPanel.GetResizeHeight(content.ContainerPane));
//.........这里部分代码省略.........
开发者ID:alexcepoi,项目名称:ShareTabWin,代码行数:101,代码来源:DockingManager.cs


注:本文中的AvalonDock.DockablePane类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。