Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / InlineUIContainer.cs / 2 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImpersonationContext.cs
- LambdaCompiler.cs
- SecurityResources.cs
- CallbackTimeoutsElement.cs
- DeadCharTextComposition.cs
- ACE.cs
- EntityContainerEmitter.cs
- DataGridHeaderBorder.cs
- StringConcat.cs
- ConvertEvent.cs
- EmbeddedMailObjectCollectionEditor.cs
- SafeNativeMethods.cs
- Selector.cs
- BufferBuilder.cs
- TdsParserStaticMethods.cs
- LocalIdKeyIdentifierClause.cs
- StoreAnnotationsMap.cs
- PublishLicense.cs
- Splitter.cs
- AppliesToBehaviorDecisionTable.cs
- CLSCompliantAttribute.cs
- NodeFunctions.cs
- AnnotationHelper.cs
- FastPropertyAccessor.cs
- DataTableReader.cs
- AudioException.cs
- RegistryKey.cs
- WebPartConnectionsConfigureVerb.cs
- DataFieldConverter.cs
- XamlBrushSerializer.cs
- HelpProvider.cs
- TokenBasedSet.cs
- SyndicationFeedFormatter.cs
- ListChangedEventArgs.cs
- WindowsListViewGroupSubsetLink.cs
- UpdateRecord.cs
- DrawingImage.cs
- Oci.cs
- FileVersion.cs
- XPathNodePointer.cs
- ProfileSettingsCollection.cs
- PageRequestManager.cs
- ReplyChannel.cs
- ViewPort3D.cs
- safelink.cs
- WebBrowserProgressChangedEventHandler.cs
- XslCompiledTransform.cs
- QueryExpr.cs
- GlobalizationAssembly.cs
- CodeComment.cs
- FtpCachePolicyElement.cs
- HttpListenerContext.cs
- DurableErrorHandler.cs
- DynamicEndpoint.cs
- PublisherIdentityPermission.cs
- ConfigurationPermission.cs
- Crc32.cs
- ContractBase.cs
- SplitterCancelEvent.cs
- CodeConstructor.cs
- Pair.cs
- Soap12ProtocolImporter.cs
- InvalidDataException.cs
- AsmxEndpointPickerExtension.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- MissingManifestResourceException.cs
- AssemblyResourceLoader.cs
- NullRuntimeConfig.cs
- ListDictionaryInternal.cs
- Attributes.cs
- Size.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- Int32.cs
- ResourceDescriptionAttribute.cs
- followingsibling.cs
- BitmapDecoder.cs
- Regex.cs
- GridViewRowEventArgs.cs
- WebServiceBindingAttribute.cs
- XmlText.cs
- TextureBrush.cs
- ScrollItemPattern.cs
- Merger.cs
- mongolianshape.cs
- BitmapEffectGroup.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- XpsFilter.cs
- ItemTypeToolStripMenuItem.cs
- RootBrowserWindowProxy.cs
- GPRECT.cs
- QueryResultOp.cs
- SqlClientMetaDataCollectionNames.cs
- HtmlTextArea.cs
- DataGridViewRowCollection.cs
- ItemDragEvent.cs
- TrackingServices.cs
- TextRangeSerialization.cs
- ViewBox.cs
- SourceItem.cs
- TransactionContextManager.cs