// Copyright (C) Josh Smith - February 2007 using System; using System.Collections; using System.Windows; namespace WPF.JoshSmith.Adorners { /// <summary> /// An adorner which can display one and only one UIElement. The element /// is added to the adorner's visual and logical trees, enabling it to /// particpate in dependency property value inheritance, amongst other things. /// </summary> /// <remarks> /// Used In: http://www.codeproject.com/KB/WPF/SmartTextBox.aspx /// </remarks> public class UIElementAdorner : SingleChildAdornerBase { #region Constructor /// <summary> /// Constructor. Adds 'childElement' to the adorner's visual and logical trees. /// </summary> /// <param name="adornedElement">The element to which the adorner will be bound.</param> /// <param name="childElement">The element to be displayed in the adorner.</param> public UIElementAdorner(UIElement adornedElement, UIElement childElement) : base(adornedElement) { if (childElement == null) throw new ArgumentNullException("childElement"); this.child = childElement; this.AddLogicalChild(childElement); this.AddVisualChild(childElement); } #endregion // Constructor #region Base Class Overrides /// <summary> /// Override. /// </summary> protected override IEnumerator LogicalChildren { get { ArrayList list = new ArrayList(); list.Add(this.child); return list.GetEnumerator(); } } #endregion // Base Class Overrides } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)