private AbstractMenuItem FromMenuItem(MenuItem item, LayoutDocumentItem doc, int priority)
        {
            bool hideDisabled = false;
            if (item != null)
            {
                ICommand cmd = null;
                if (doc != null)
                {
                    if (item.Header.ToString() == Xceed.Wpf.AvalonDock.Properties.Resources.Document_Close)
                    {
                        cmd = doc.CloseCommand;
                    }
                    if (item.Header.ToString() == Xceed.Wpf.AvalonDock.Properties.Resources.Document_CloseAllButThis)
                    {
                        cmd = doc.CloseAllButThisCommand;
                    }
                    if (item.Header.ToString() == Xceed.Wpf.AvalonDock.Properties.Resources.Document_Float)
                    {
                        cmd = doc.FloatCommand;
                        hideDisabled = true;
                    }
                    if (item.Header.ToString() == Xceed.Wpf.AvalonDock.Properties.Resources.Document_DockAsDocument)
                    {
                        cmd = doc.DockAsDocumentCommand;
                        hideDisabled = true;
                    }
                    if (item.Header.ToString() ==
                        Xceed.Wpf.AvalonDock.Properties.Resources.Document_NewHorizontalTabGroup)
                    {
                        cmd = doc.NewHorizontalTabGroupCommand;
                        hideDisabled = true;
                    }
                    if (item.Header.ToString() == Xceed.Wpf.AvalonDock.Properties.Resources.Document_NewVerticalTabGroup)
                    {
                        cmd = doc.NewVerticalTabGroupCommand;
                        hideDisabled = true;
                    }
                    if (item.Header.ToString() == Xceed.Wpf.AvalonDock.Properties.Resources.Document_MoveToNextTabGroup)
                    {
                        cmd = doc.MoveToNextTabGroupCommand;
                        hideDisabled = true;
                    }
                    if (item.Header.ToString() ==
                        Xceed.Wpf.AvalonDock.Properties.Resources.Document_MoveToPreviousTabGroup)
                    {
                        cmd = doc.MoveToPreviousTabGroupCommand;
                        hideDisabled = true;
                    }
                }

                MenuItemViewModel model = new MenuItemViewModel(item.Header.ToString(), priority,
                                                                item.Icon != null ? (item.Icon as Image).Source : null,
                                                                cmd, null, false, hideDisabled);
                return model;
            }
            return null;
        }
예제 #2
0
        private void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect)
        {
            _internalSetSelectedDocument = true;
            this.SelectedDocument        = documentToSelect;
            _internalSetSelectedDocument = false;

            if ((_documentListBox != null) && (documentToSelect != null))
            {
                _documentListBox.Focus();
            }
        }
 void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect)
 {
     _internalSetSelectedDocument = true;
     SelectedDocument             = documentToSelect;
     _internalSetSelectedDocument = false;
 }
 void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect)
 {
     _internalSetSelectedDocument = true;
     SelectedDocument = documentToSelect;
     _internalSetSelectedDocument = false;
 }
 /// <summary>
 /// Provides a secure method for setting the Documents property.  
 /// This dependency property indicates the list of documents.
 /// </summary>
 /// <param name="value">The new value for the property.</param>
 protected void SetDocuments(LayoutDocumentItem[] value)
 {
     SetValue(DocumentsPropertyKey, value);
 }
        void CreateDocumentLayoutItem(LayoutDocument contentToAttach)
        {
            if (_layoutItems.Any(item => item.LayoutElement == contentToAttach))
                return;

            var layoutItem = new LayoutDocumentItem();
            layoutItem.Attach(contentToAttach);
            ApplyStyleToLayoutItem(layoutItem);
            _layoutItems.Add(layoutItem);

            if (contentToAttach != null &&
                contentToAttach.Content != null &&
                contentToAttach.Content is UIElement)
            {
                InternalAddLogicalChild(contentToAttach.Content);
            }
        }
예제 #7
0
 private void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect)
 {
     this._internalSetSelectedDocument = true;
     this.SelectedDocument             = documentToSelect;
     this._internalSetSelectedDocument = false;
 }