Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Documents / InlineUIContainer.cs / 1 / InlineUIContainer.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: InlineUIContainer - a wrapper for embedded UIElements in text // flow content inline collections // //--------------------------------------------------------------------------- using System.ComponentModel; // DesignerSerializationVisibility using System.Windows.Markup; // XamlDesignerSerializationManager using MS.Internal; using MS.Internal.Documents; namespace System.Windows.Documents { ////// InlineUIContainer - a wrapper for embedded UIElements in text /// flow content inline collections /// [ContentProperty("Child")] [TextElementEditingBehaviorAttribute(IsMergeable = false)] public class InlineUIContainer : Inline { //------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------- #region Constructors ////// Initializes a new instance of InlineUIContainer element. /// ////// The purpose of this element is to be a wrapper for UIElements /// when they are embedded into text flow - as items of /// InlineCollections. /// public InlineUIContainer() { } ////// Initializes an InlineBox specifying its child UIElement /// /// /// UIElement set as a child of this inline item /// public InlineUIContainer(UIElement childUIElement) : this(childUIElement, null) { } ////// Creates a new InlineUIContainer instance. /// /// /// Optional child of the new InlineUIContainer, may be null. /// /// /// Optional position at which to insert the new InlineUIContainer. May /// be null. /// public InlineUIContainer(UIElement childUIElement, TextPointer insertionPosition) { if (insertionPosition != null) { insertionPosition.TextContainer.BeginChange(); } try { if (insertionPosition != null) { // This will throw InvalidOperationException if schema validity is violated. insertionPosition.InsertInline(this); } this.Child = childUIElement; } finally { if (insertionPosition != null) { insertionPosition.TextContainer.EndChange(); } } } #endregion Constructors //-------------------------------------------------------------------- // // Public Properties // //------------------------------------------------------------------- #region Public Properties ////// The content spanned by this TextElement. /// public UIElement Child { get { return this.ContentStart.GetAdjacentElement(LogicalDirection.Forward) as UIElement; } set { TextContainer textContainer = this.TextContainer; textContainer.BeginChange(); try { TextPointer contentStart = this.ContentStart; UIElement child = Child; if (child != null) { textContainer.DeleteContentInternal(contentStart, this.ContentEnd); ContainerTextElementField.ClearValue(child); } if (value != null) { ContainerTextElementField.SetValue(value, this); contentStart.InsertUIElement(value); } } finally { textContainer.EndChange(); } } } #endregion Public Properties #region Internal Properties ////// UIElementIsland representing embedded Element Layout island within content world. /// internal UIElementIsland UIElementIsland { get { UpdateUIElementIsland(); return _uiElementIsland; } } #endregion Internal Properties #region Private Methods ////// Ensures the _uiElementIsland variable is up to date /// private void UpdateUIElementIsland() { UIElement childElement = this.Child; if(_uiElementIsland == null || _uiElementIsland.Root != childElement) { if(_uiElementIsland != null) { _uiElementIsland.Dispose(); _uiElementIsland = null; } if(childElement != null) { _uiElementIsland = new UIElementIsland(childElement); } } } #endregion Private Methods #region Private Data private UIElementIsland _uiElementIsland; #endregion Private Data } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: InlineUIContainer - a wrapper for embedded UIElements in text // flow content inline collections // //--------------------------------------------------------------------------- using System.ComponentModel; // DesignerSerializationVisibility using System.Windows.Markup; // XamlDesignerSerializationManager using MS.Internal; using MS.Internal.Documents; namespace System.Windows.Documents { ////// InlineUIContainer - a wrapper for embedded UIElements in text /// flow content inline collections /// [ContentProperty("Child")] [TextElementEditingBehaviorAttribute(IsMergeable = false)] public class InlineUIContainer : Inline { //------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------- #region Constructors ////// Initializes a new instance of InlineUIContainer element. /// ////// The purpose of this element is to be a wrapper for UIElements /// when they are embedded into text flow - as items of /// InlineCollections. /// public InlineUIContainer() { } ////// Initializes an InlineBox specifying its child UIElement /// /// /// UIElement set as a child of this inline item /// public InlineUIContainer(UIElement childUIElement) : this(childUIElement, null) { } ////// Creates a new InlineUIContainer instance. /// /// /// Optional child of the new InlineUIContainer, may be null. /// /// /// Optional position at which to insert the new InlineUIContainer. May /// be null. /// public InlineUIContainer(UIElement childUIElement, TextPointer insertionPosition) { if (insertionPosition != null) { insertionPosition.TextContainer.BeginChange(); } try { if (insertionPosition != null) { // This will throw InvalidOperationException if schema validity is violated. insertionPosition.InsertInline(this); } this.Child = childUIElement; } finally { if (insertionPosition != null) { insertionPosition.TextContainer.EndChange(); } } } #endregion Constructors //-------------------------------------------------------------------- // // Public Properties // //------------------------------------------------------------------- #region Public Properties ////// The content spanned by this TextElement. /// public UIElement Child { get { return this.ContentStart.GetAdjacentElement(LogicalDirection.Forward) as UIElement; } set { TextContainer textContainer = this.TextContainer; textContainer.BeginChange(); try { TextPointer contentStart = this.ContentStart; UIElement child = Child; if (child != null) { textContainer.DeleteContentInternal(contentStart, this.ContentEnd); ContainerTextElementField.ClearValue(child); } if (value != null) { ContainerTextElementField.SetValue(value, this); contentStart.InsertUIElement(value); } } finally { textContainer.EndChange(); } } } #endregion Public Properties #region Internal Properties ////// UIElementIsland representing embedded Element Layout island within content world. /// internal UIElementIsland UIElementIsland { get { UpdateUIElementIsland(); return _uiElementIsland; } } #endregion Internal Properties #region Private Methods ////// Ensures the _uiElementIsland variable is up to date /// private void UpdateUIElementIsland() { UIElement childElement = this.Child; if(_uiElementIsland == null || _uiElementIsland.Root != childElement) { if(_uiElementIsland != null) { _uiElementIsland.Dispose(); _uiElementIsland = null; } if(childElement != null) { _uiElementIsland = new UIElementIsland(childElement); } } } #endregion Private Methods #region Private Data private UIElementIsland _uiElementIsland; #endregion Private Data } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Dynamic.cs
- ApplicationId.cs
- ObjectDataSourceMethodEventArgs.cs
- Rijndael.cs
- PanelDesigner.cs
- SamlAuthorizationDecisionClaimResource.cs
- HandoffBehavior.cs
- TraceSection.cs
- XPathAxisIterator.cs
- HttpApplication.cs
- ObjectQuery.cs
- HttpCachePolicyElement.cs
- ThicknessAnimation.cs
- CallbackValidatorAttribute.cs
- TileModeValidation.cs
- DataColumn.cs
- ActivityCodeDomSerializationManager.cs
- TemplatePartAttribute.cs
- Subordinate.cs
- SystemIPGlobalProperties.cs
- ApplyTemplatesAction.cs
- XhtmlTextWriter.cs
- Tuple.cs
- TransportationConfigurationTypeInstallComponent.cs
- ReflectTypeDescriptionProvider.cs
- TextServicesCompartmentEventSink.cs
- DetailsView.cs
- GradientBrush.cs
- IssuanceLicense.cs
- TypeListConverter.cs
- QilIterator.cs
- FixedSOMTableRow.cs
- Debug.cs
- CustomErrorCollection.cs
- RelationHandler.cs
- XmlSchemaComplexContent.cs
- CommentAction.cs
- AppPool.cs
- Binding.cs
- SrgsSubset.cs
- XamlSerializationHelper.cs
- ByteAnimationUsingKeyFrames.cs
- GZipDecoder.cs
- ByValueEqualityComparer.cs
- DataBoundControl.cs
- EntityViewGenerator.cs
- DbProviderFactoriesConfigurationHandler.cs
- SingleObjectCollection.cs
- BindableAttribute.cs
- ObjectListCommand.cs
- PropertyPathWorker.cs
- AppDomainUnloadedException.cs
- ProfileServiceManager.cs
- OdbcHandle.cs
- LogicalTreeHelper.cs
- ParameterReplacerVisitor.cs
- StorageBasedPackageProperties.cs
- MimeMultiPart.cs
- TrustSection.cs
- SimpleWorkerRequest.cs
- NetSectionGroup.cs
- HttpRuntimeSection.cs
- AssemblyBuilder.cs
- RawStylusSystemGestureInputReport.cs
- CompiledELinqQueryState.cs
- RangeBase.cs
- RouteItem.cs
- Rfc2898DeriveBytes.cs
- DWriteFactory.cs
- EventPrivateKey.cs
- EntityStoreSchemaFilterEntry.cs
- SslStreamSecurityElement.cs
- FlowDocumentPageViewerAutomationPeer.cs
- BitmapEffectDrawingContent.cs
- NullRuntimeConfig.cs
- EventMappingSettingsCollection.cs
- StringUtil.cs
- DetailsView.cs
- SqlReorderer.cs
- URIFormatException.cs
- DrawingImage.cs
- FontInfo.cs
- SQLGuidStorage.cs
- XmlNamedNodeMap.cs
- ListViewItem.cs
- OrderedDictionary.cs
- BitmapEffectrendercontext.cs
- GlobalEventManager.cs
- Padding.cs
- InputElement.cs
- AssertFilter.cs
- FilterEventArgs.cs
- XmlJsonWriter.cs
- LockCookie.cs
- AnnotationResourceCollection.cs
- VectorCollectionConverter.cs
- Random.cs
- RuleSettingsCollection.cs
- RectangleGeometry.cs
- HashHelper.cs