Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- ViewGenerator.cs
- ArglessEventHandlerProxy.cs
- PhysicalAddress.cs
- TypeLibConverter.cs
- TypeConverterAttribute.cs
- ImplicitInputBrush.cs
- WebPartTransformerAttribute.cs
- AnyAllSearchOperator.cs
- Pair.cs
- InstanceOwner.cs
- AssociationType.cs
- Schedule.cs
- WebSysDisplayNameAttribute.cs
- ClientSideProviderDescription.cs
- WeakReferenceList.cs
- DrawingVisual.cs
- ActivitySurrogateSelector.cs
- GeneralTransform3DGroup.cs
- SerializationStore.cs
- FtpWebResponse.cs
- OperationResponse.cs
- ContainerUIElement3D.cs
- XamlParser.cs
- DesignerActionHeaderItem.cs
- DESCryptoServiceProvider.cs
- BamlResourceContent.cs
- NativeMethods.cs
- SqlCachedBuffer.cs
- DiscoveryDefaults.cs
- RijndaelManaged.cs
- ActivityExecutionWorkItem.cs
- HMACSHA512.cs
- IdleTimeoutMonitor.cs
- PageContentAsyncResult.cs
- HttpApplication.cs
- RegexCode.cs
- Exception.cs
- EncodingDataItem.cs
- DataSetFieldSchema.cs
- SqlTrackingQuery.cs
- ContentType.cs
- StickyNoteHelper.cs
- SmiMetaData.cs
- PropertyEmitter.cs
- DESCryptoServiceProvider.cs
- DiagnosticsConfiguration.cs
- ClientOptions.cs
- PositiveTimeSpanValidatorAttribute.cs
- QueryTask.cs
- Model3DGroup.cs
- EDesignUtil.cs
- WebPartExportVerb.cs
- PowerModeChangedEventArgs.cs
- TrustSection.cs
- MobileListItem.cs
- MailWebEventProvider.cs
- SystemNetworkInterface.cs
- IOThreadTimer.cs
- NamespaceTable.cs
- SessionPageStateSection.cs
- odbcmetadatacolumnnames.cs
- _ScatterGatherBuffers.cs
- DataControlImageButton.cs
- PropertyRef.cs
- HttpDebugHandler.cs
- DataColumnPropertyDescriptor.cs
- ProcessHost.cs
- GuidConverter.cs
- TableAdapterManagerNameHandler.cs
- SmiContext.cs
- SatelliteContractVersionAttribute.cs
- DuplicateWaitObjectException.cs
- FieldDescriptor.cs
- ZipArchive.cs
- ByteAnimationBase.cs
- TableCellAutomationPeer.cs
- InstallerTypeAttribute.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- WindowVisualStateTracker.cs
- baseshape.cs
- dataobject.cs
- HMACSHA512.cs
- coordinatorfactory.cs
- SupportingTokenChannel.cs
- GeneralTransform2DTo3DTo2D.cs
- HierarchicalDataBoundControlAdapter.cs
- NGCSerializerAsync.cs
- SqlOuterApplyReducer.cs
- ExternalCalls.cs
- PixelShader.cs
- PackUriHelper.cs
- DataChangedEventManager.cs
- TextLine.cs
- ScrollChangedEventArgs.cs
- ObjectItemLoadingSessionData.cs
- NameValuePermission.cs
- Polygon.cs
- DataSourceProvider.cs
- ObjectPersistData.cs
- JavaScriptObjectDeserializer.cs