private void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect) { _internalSetSelectedDocument = true; this.SelectedDocument = documentToSelect; _internalSetSelectedDocument = false; if ((_documentListBox != null) && (documentToSelect != null)) { _documentListBox.Focus(); } }
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); } }
void InternalSetSelectedDocument(LayoutDocumentItem documentToSelect) { _internalSetSelectedDocument = true; SelectedDocument = documentToSelect; _internalSetSelectedDocument = false; }
void Layout_ElementAdded(object sender, LayoutElementEventArgs e) { if (_suspendLayoutItemCreation) return; if (e.Element is LayoutDocument) { var document = e.Element as LayoutDocument; var documentItem = new LayoutDocumentItem(); documentItem.Attach(document); ApplyStyleToLayoutItem(documentItem); _layoutItems.Add(documentItem); } else if (e.Element is LayoutAnchorable) { var anchorable = e.Element as LayoutAnchorable; var anchorableItem = new LayoutAnchorableItem(); anchorableItem.Attach(anchorable); ApplyStyleToLayoutItem(anchorableItem); _layoutItems.Add(anchorableItem); } else if (e.Element is ILayoutContainer) { foreach (var document in e.Element.Descendents().OfType<LayoutDocument>().ToArray()) { var documentItem = new LayoutDocumentItem(); documentItem.Attach(document); ApplyStyleToLayoutItem(documentItem); _layoutItems.Add(documentItem); } foreach (var anchorable in e.Element.Descendents().OfType<LayoutAnchorable>().ToArray()) { var anchorableItem = new LayoutAnchorableItem(); anchorableItem.Attach(anchorable); ApplyStyleToLayoutItem(anchorableItem); _layoutItems.Add(anchorableItem); } } }
void AttachLayoutItems() { if (Layout != null) { foreach (var document in Layout.Descendents().OfType<LayoutDocument>().ToArray()) { var documentItem = new LayoutDocumentItem(); documentItem.Attach(document); ApplyStyleToLayoutItem(documentItem); _layoutItems.Add(documentItem); } foreach (var anchorable in Layout.Descendents().OfType<LayoutAnchorable>().ToArray()) { var anchorableItem = new LayoutAnchorableItem(); anchorableItem.Attach(anchorable); ApplyStyleToLayoutItem(anchorableItem); _layoutItems.Add(anchorableItem); } Layout.ElementAdded += new EventHandler<LayoutElementEventArgs>(Layout_ElementAdded); Layout.ElementRemoved += new EventHandler<LayoutElementEventArgs>(Layout_ElementRemoved); } }
/// <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); }