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
- DataControlButton.cs
- _AutoWebProxyScriptHelper.cs
- FocusWithinProperty.cs
- DataRow.cs
- ChangeProcessor.cs
- Wrapper.cs
- LogicalTreeHelper.cs
- FloaterBaseParagraph.cs
- SimpleNameService.cs
- ProgressBarAutomationPeer.cs
- ModelVisual3D.cs
- XamlStream.cs
- HttpModuleAction.cs
- ping.cs
- TextRangeEdit.cs
- processwaithandle.cs
- DefaultObjectMappingItemCollection.cs
- TabRenderer.cs
- SqlTriggerAttribute.cs
- MarkedHighlightComponent.cs
- BitStream.cs
- SafeHandles.cs
- WebPartZone.cs
- TypeExtension.cs
- TdsParserSafeHandles.cs
- InputLanguageSource.cs
- PolyLineSegment.cs
- SqlRecordBuffer.cs
- IEnumerable.cs
- InternalConfirm.cs
- DisplayInformation.cs
- ObjectParameter.cs
- DecoratedNameAttribute.cs
- CompilerCollection.cs
- TaskHelper.cs
- OleDbParameterCollection.cs
- InheritanceContextHelper.cs
- AvTraceDetails.cs
- EmissiveMaterial.cs
- GregorianCalendarHelper.cs
- HttpApplication.cs
- QuaternionAnimationUsingKeyFrames.cs
- RepeatInfo.cs
- NumberSubstitution.cs
- DocumentEventArgs.cs
- OptionalColumn.cs
- ExpressionBindings.cs
- codemethodreferenceexpression.cs
- GlyphTypeface.cs
- AdapterDictionary.cs
- SafeRightsManagementHandle.cs
- DataRelation.cs
- TextPenaltyModule.cs
- CommandID.cs
- SettingsAttributes.cs
- InstanceDataCollection.cs
- VScrollProperties.cs
- TextBoxAutoCompleteSourceConverter.cs
- HandledMouseEvent.cs
- ClusterSafeNativeMethods.cs
- VectorAnimation.cs
- TimeIntervalCollection.cs
- DefaultValueAttribute.cs
- Point.cs
- _NestedMultipleAsyncResult.cs
- XmlEncApr2001.cs
- Action.cs
- CheckBox.cs
- ExceptionRoutedEventArgs.cs
- FindCriteria11.cs
- XmlNavigatorStack.cs
- FontSource.cs
- ExpressionEditorAttribute.cs
- ScriptIgnoreAttribute.cs
- MonitorWrapper.cs
- EdmSchemaAttribute.cs
- SQLInt32.cs
- XpsFont.cs
- ComponentEditorForm.cs
- ResourceReferenceKeyNotFoundException.cs
- securitycriticaldata.cs
- TimerTable.cs
- OperatingSystem.cs
- XamlRtfConverter.cs
- CssStyleCollection.cs
- DataObject.cs
- FontStretchConverter.cs
- XhtmlBasicControlAdapter.cs
- ApplicationActivator.cs
- Canvas.cs
- DrawingContext.cs
- GridViewItemAutomationPeer.cs
- FeatureManager.cs
- XmlArrayAttribute.cs
- AssemblyInfo.cs
- TextRunCache.cs
- LogAppendAsyncResult.cs
- GPRECTF.cs
- DocumentSequenceHighlightLayer.cs
- ImpersonationContext.cs