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
- Style.cs
- MethodCallConverter.cs
- FilteredDataSetHelper.cs
- SwitchLevelAttribute.cs
- ReferencedCollectionType.cs
- MetabaseServerConfig.cs
- HttpValueCollection.cs
- AbstractSvcMapFileLoader.cs
- ScriptBehaviorDescriptor.cs
- WindowsRichEditRange.cs
- BypassElementCollection.cs
- DocumentXmlWriter.cs
- ContentHostHelper.cs
- DataServiceQuery.cs
- StatusBarPanelClickEvent.cs
- ManifestResourceInfo.cs
- BindingGraph.cs
- DispatcherHooks.cs
- DependencyPropertyKind.cs
- HwndSource.cs
- HotCommands.cs
- Translator.cs
- CompositeKey.cs
- BamlRecords.cs
- CategoryAttribute.cs
- UserPersonalizationStateInfo.cs
- Exceptions.cs
- ClientData.cs
- File.cs
- GlyphElement.cs
- PeerNameResolver.cs
- XmlWriterDelegator.cs
- DataGridCommandEventArgs.cs
- ErrorHandlerModule.cs
- DeploymentSectionCache.cs
- LazyLoadBehavior.cs
- BitmapImage.cs
- MultipartContentParser.cs
- ValueExpressions.cs
- TextAutomationPeer.cs
- UTF32Encoding.cs
- SchemaElementDecl.cs
- AutomationEvent.cs
- AddInController.cs
- serverconfig.cs
- ChildrenQuery.cs
- EnumCodeDomSerializer.cs
- ContractsBCL.cs
- SystemIcons.cs
- CharKeyFrameCollection.cs
- _FtpControlStream.cs
- PageRequestManager.cs
- PreProcessor.cs
- XamlRtfConverter.cs
- XpsTokenContext.cs
- ClientSettingsStore.cs
- ContentOnlyMessage.cs
- SQLDouble.cs
- CmsUtils.cs
- DataSourceHelper.cs
- EventListenerClientSide.cs
- LinkAreaEditor.cs
- Context.cs
- _HTTPDateParse.cs
- RowToParametersTransformer.cs
- ResourcePermissionBaseEntry.cs
- PathFigureCollection.cs
- RecognizerStateChangedEventArgs.cs
- ReadOnlyDataSource.cs
- CompressedStack.cs
- RelationshipNavigation.cs
- DnsPermission.cs
- XmlDictionaryReaderQuotasElement.cs
- SettingsProviderCollection.cs
- UnsafeNativeMethods.cs
- ProcessHostFactoryHelper.cs
- InkSerializer.cs
- HasActivatableWorkflowEvent.cs
- ActivityExecutionContext.cs
- objectresult_tresulttype.cs
- ViewStateChangedEventArgs.cs
- WindowsSysHeader.cs
- TextElementEnumerator.cs
- bidPrivateBase.cs
- HwndSourceParameters.cs
- DesignerActionList.cs
- FixedLineResult.cs
- RangeExpression.cs
- StringArrayEditor.cs
- EventLogPermission.cs
- StringStorage.cs
- TypeNameHelper.cs
- EncodingDataItem.cs
- DataGridViewHeaderCell.cs
- RolePrincipal.cs
- EntitySetBaseCollection.cs
- ConfigurationSectionCollection.cs
- SchemaComplexType.cs
- MediaContextNotificationWindow.cs
- WebPartAddingEventArgs.cs