Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / BlockUIContainer.cs / 1305600 / BlockUIContainer.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// Description: BlockUIContainer - a wrapper for embedded UIElements in text
// flow content block collections
//
//---------------------------------------------------------------------------
using System.ComponentModel; // DesignerSerializationVisibility
using System.Windows.Markup; // ContentProperty
namespace System.Windows.Documents
{
///
/// BlockUIContainer - a wrapper for embedded UIElements in text
/// flow content block collections
///
[ContentProperty("Child")]
public class BlockUIContainer : Block
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
#region Constructors
///
/// Initializes a new instance of BlockUIContainer element.
///
///
/// The purpose of this element is to be a wrapper for UIElements
/// when they are embedded into text flow - as items of
/// BlockCollections.
///
public BlockUIContainer()
: base()
{
}
///
/// Initializes an BlockUIContainer specifying its child UIElement
///
///
/// UIElement set as a child of this block item
///
public BlockUIContainer(UIElement uiElement)
: base()
{
if (uiElement == null)
{
throw new ArgumentNullException("uiElement");
}
this.Child = uiElement;
}
#endregion Constructors
//--------------------------------------------------------------------
//
// Public Properties
//
//-------------------------------------------------------------------
#region 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
}
}
// 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: BlockUIContainer - a wrapper for embedded UIElements in text
// flow content block collections
//
//---------------------------------------------------------------------------
using System.ComponentModel; // DesignerSerializationVisibility
using System.Windows.Markup; // ContentProperty
namespace System.Windows.Documents
{
///
/// BlockUIContainer - a wrapper for embedded UIElements in text
/// flow content block collections
///
[ContentProperty("Child")]
public class BlockUIContainer : Block
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
#region Constructors
///
/// Initializes a new instance of BlockUIContainer element.
///
///
/// The purpose of this element is to be a wrapper for UIElements
/// when they are embedded into text flow - as items of
/// BlockCollections.
///
public BlockUIContainer()
: base()
{
}
///
/// Initializes an BlockUIContainer specifying its child UIElement
///
///
/// UIElement set as a child of this block item
///
public BlockUIContainer(UIElement uiElement)
: base()
{
if (uiElement == null)
{
throw new ArgumentNullException("uiElement");
}
this.Child = uiElement;
}
#endregion Constructors
//--------------------------------------------------------------------
//
// Public Properties
//
//-------------------------------------------------------------------
#region 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
}
}
// 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
- TextEditorSelection.cs
- ReadOnlyAttribute.cs
- SelectionProviderWrapper.cs
- StickyNote.cs
- FixedSOMSemanticBox.cs
- ProfileBuildProvider.cs
- complextypematerializer.cs
- DiscoveryDocument.cs
- ObjectCloneHelper.cs
- VisualBrush.cs
- SecurityTraceRecordHelper.cs
- followingsibling.cs
- WindowsProgressbar.cs
- Activity.cs
- WebBrowserContainer.cs
- VisualProxy.cs
- ExpandoClass.cs
- TransformGroup.cs
- DefaultTypeArgumentAttribute.cs
- PerformanceCountersElement.cs
- Activator.cs
- SafeFileMapViewHandle.cs
- clipboard.cs
- XmlSchemaExporter.cs
- AssemblyBuilderData.cs
- CodeVariableDeclarationStatement.cs
- QilChoice.cs
- InvalidOleVariantTypeException.cs
- InlineCollection.cs
- WsdlBuildProvider.cs
- XmlDataSourceNodeDescriptor.cs
- AutomationPattern.cs
- PrintPreviewGraphics.cs
- InkCanvasFeedbackAdorner.cs
- CompositeScriptReferenceEventArgs.cs
- StringInfo.cs
- EncoderParameter.cs
- StorageEndPropertyMapping.cs
- CodeMemberField.cs
- TimeStampChecker.cs
- XsltLibrary.cs
- PropertyChangeTracker.cs
- ActivityDefaults.cs
- StorageEndPropertyMapping.cs
- AdCreatedEventArgs.cs
- VersionedStream.cs
- CrossSiteScriptingValidation.cs
- XPathDocumentIterator.cs
- BaseCodePageEncoding.cs
- CacheRequest.cs
- Int32Rect.cs
- OdbcConnectionFactory.cs
- ConvertersCollection.cs
- XmlElement.cs
- LinqDataSourceHelper.cs
- InvalidDataContractException.cs
- SafeSecurityHandles.cs
- SpnEndpointIdentityExtension.cs
- FixedSOMContainer.cs
- LongPath.cs
- TrackingMemoryStreamFactory.cs
- XmlSchemaSimpleContentExtension.cs
- Mappings.cs
- StylusButtonEventArgs.cs
- BitStream.cs
- AssemblyBuilderData.cs
- TaiwanLunisolarCalendar.cs
- DbException.cs
- XmlChoiceIdentifierAttribute.cs
- X509CertificateCollection.cs
- SQLBytesStorage.cs
- CopyOfAction.cs
- ServiceDeploymentInfo.cs
- CompletionBookmark.cs
- SynthesizerStateChangedEventArgs.cs
- HostingEnvironment.cs
- TemplateKeyConverter.cs
- SortDescriptionCollection.cs
- BufferedResponseStream.cs
- IndexedGlyphRun.cs
- DataRecordInternal.cs
- UIElementParagraph.cs
- XmlFormatExtensionPrefixAttribute.cs
- DateTimeOffset.cs
- ReceiveReply.cs
- AsyncOperationManager.cs
- TokenBasedSet.cs
- AgileSafeNativeMemoryHandle.cs
- TaskFileService.cs
- EntityDesignerBuildProvider.cs
- ObfuscateAssemblyAttribute.cs
- LocatorGroup.cs
- SchemaDeclBase.cs
- peernodeimplementation.cs
- ContainerParaClient.cs
- ReadOnlyDictionary.cs
- SQlBooleanStorage.cs
- COM2PictureConverter.cs
- LinkedList.cs
- EntityClientCacheKey.cs