Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Documents / AnchoredBlock.cs / 1 / AnchoredBlock.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// Description: AnchoredBlock element.
// AnchoredBlock element - an abstract class used as a base for
// TextElements incorporated (anchored) into text flow on inline level,
// but appearing visually in separate block.
// Derived concrete classes are: Floater and Figure.
//
//---------------------------------------------------------------------------
using System.ComponentModel; // TypeConverter
using System.Windows.Media; // Brush
using System.Windows.Markup; // ContentProperty
using MS.Internal;
namespace System.Windows.Documents
{
///
/// AnchoredBlock element - an abstract class used as a base for
/// TextElements incorporated (anchored) into text flow on inline level,
/// but appearing visually in separate block.
/// Derived concrete classes are: Flowter and Figure.
///
[ContentProperty("Blocks")]
public abstract class AnchoredBlock : Inline
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
#region Constructors
///
/// Creates a new AnchoredBlock instance.
///
///
/// Optional child of the new AnchoredBlock, may be null.
///
///
/// Optional position at which to insert the new AnchoredBlock. May
/// be null.
///
protected AnchoredBlock(Block block, TextPointer insertionPosition)
{
if (insertionPosition != null)
{
insertionPosition.TextContainer.BeginChange();
}
try
{
if (insertionPosition != null)
{
// This will throw InvalidOperationException if schema validity is violated.
insertionPosition.InsertInline(this);
}
if (block != null)
{
this.Blocks.Add(block);
}
}
finally
{
if (insertionPosition != null)
{
insertionPosition.TextContainer.EndChange();
}
}
}
#endregion Constructors
//--------------------------------------------------------------------
//
// Public Properties
//
//-------------------------------------------------------------------
#region Public Properties
///
/// Collection of Blocks contained in this element
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public BlockCollection Blocks
{
get
{
return new BlockCollection(this, /*isOwnerParent*/true);
}
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty MarginProperty =
Block.MarginProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
new Thickness(Double.NaN),
FrameworkPropertyMetadataOptions.AffectsMeasure));
///
/// The Margin property specifies the margin of the element.
///
public Thickness Margin
{
get { return (Thickness)GetValue(MarginProperty); }
set { SetValue(MarginProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty PaddingProperty =
Block.PaddingProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
new Thickness(Double.NaN),
FrameworkPropertyMetadataOptions.AffectsMeasure));
///
/// The Padding property specifies the padding of the element.
///
public Thickness Padding
{
get { return (Thickness)GetValue(PaddingProperty); }
set { SetValue(PaddingProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty BorderThicknessProperty =
Block.BorderThicknessProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
new Thickness(),
FrameworkPropertyMetadataOptions.AffectsMeasure));
///
/// The BorderThickness property specifies the border of the element.
///
public Thickness BorderThickness
{
get { return (Thickness)GetValue(BorderThicknessProperty); }
set { SetValue(BorderThicknessProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty BorderBrushProperty =
Block.BorderBrushProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
null,
FrameworkPropertyMetadataOptions.AffectsRender));
///
/// The BorderBrush property specifies the brush of the border.
///
public Brush BorderBrush
{
get { return (Brush)GetValue(BorderBrushProperty); }
set { SetValue(BorderBrushProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty TextAlignmentProperty =
Block.TextAlignmentProperty.AddOwner(typeof(AnchoredBlock));
///
///
///
public TextAlignment TextAlignment
{
get { return (TextAlignment)GetValue(TextAlignmentProperty); }
set { SetValue(TextAlignmentProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty LineHeightProperty =
Block.LineHeightProperty.AddOwner(typeof(AnchoredBlock));
///
/// The LineHeight property specifies the height of each generated line box.
///
[TypeConverter(typeof(LengthConverter))]
public double LineHeight
{
get { return (double)GetValue(LineHeightProperty); }
set { SetValue(LineHeightProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty LineStackingStrategyProperty =
Block.LineStackingStrategyProperty.AddOwner(typeof(AnchoredBlock));
///
/// The LineStackingStrategy property specifies how lines are placed
///
public LineStackingStrategy LineStackingStrategy
{
get { return (LineStackingStrategy)GetValue(LineStackingStrategyProperty); }
set { SetValue(LineStackingStrategyProperty, value); }
}
#endregion Public Proterties
#region Internal Methods
///
/// This method is used by TypeDescriptor to determine if this property should
/// be serialized.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeBlocks(XamlDesignerSerializationManager manager)
{
return manager != null && manager.XmlWriter == null;
}
#endregion
//------------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
///
/// Marks this element's left edge as visible to IMEs.
/// This means element boundaries will act as word breaks.
///
internal override bool IsIMEStructuralElement
{
get
{
return true;
}
}
#endregion Internal Properties
}
}
// 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: AnchoredBlock element.
// AnchoredBlock element - an abstract class used as a base for
// TextElements incorporated (anchored) into text flow on inline level,
// but appearing visually in separate block.
// Derived concrete classes are: Floater and Figure.
//
//---------------------------------------------------------------------------
using System.ComponentModel; // TypeConverter
using System.Windows.Media; // Brush
using System.Windows.Markup; // ContentProperty
using MS.Internal;
namespace System.Windows.Documents
{
///
/// AnchoredBlock element - an abstract class used as a base for
/// TextElements incorporated (anchored) into text flow on inline level,
/// but appearing visually in separate block.
/// Derived concrete classes are: Flowter and Figure.
///
[ContentProperty("Blocks")]
public abstract class AnchoredBlock : Inline
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
#region Constructors
///
/// Creates a new AnchoredBlock instance.
///
///
/// Optional child of the new AnchoredBlock, may be null.
///
///
/// Optional position at which to insert the new AnchoredBlock. May
/// be null.
///
protected AnchoredBlock(Block block, TextPointer insertionPosition)
{
if (insertionPosition != null)
{
insertionPosition.TextContainer.BeginChange();
}
try
{
if (insertionPosition != null)
{
// This will throw InvalidOperationException if schema validity is violated.
insertionPosition.InsertInline(this);
}
if (block != null)
{
this.Blocks.Add(block);
}
}
finally
{
if (insertionPosition != null)
{
insertionPosition.TextContainer.EndChange();
}
}
}
#endregion Constructors
//--------------------------------------------------------------------
//
// Public Properties
//
//-------------------------------------------------------------------
#region Public Properties
///
/// Collection of Blocks contained in this element
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public BlockCollection Blocks
{
get
{
return new BlockCollection(this, /*isOwnerParent*/true);
}
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty MarginProperty =
Block.MarginProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
new Thickness(Double.NaN),
FrameworkPropertyMetadataOptions.AffectsMeasure));
///
/// The Margin property specifies the margin of the element.
///
public Thickness Margin
{
get { return (Thickness)GetValue(MarginProperty); }
set { SetValue(MarginProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty PaddingProperty =
Block.PaddingProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
new Thickness(Double.NaN),
FrameworkPropertyMetadataOptions.AffectsMeasure));
///
/// The Padding property specifies the padding of the element.
///
public Thickness Padding
{
get { return (Thickness)GetValue(PaddingProperty); }
set { SetValue(PaddingProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty BorderThicknessProperty =
Block.BorderThicknessProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
new Thickness(),
FrameworkPropertyMetadataOptions.AffectsMeasure));
///
/// The BorderThickness property specifies the border of the element.
///
public Thickness BorderThickness
{
get { return (Thickness)GetValue(BorderThicknessProperty); }
set { SetValue(BorderThicknessProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty BorderBrushProperty =
Block.BorderBrushProperty.AddOwner(
typeof(AnchoredBlock),
new FrameworkPropertyMetadata(
null,
FrameworkPropertyMetadataOptions.AffectsRender));
///
/// The BorderBrush property specifies the brush of the border.
///
public Brush BorderBrush
{
get { return (Brush)GetValue(BorderBrushProperty); }
set { SetValue(BorderBrushProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty TextAlignmentProperty =
Block.TextAlignmentProperty.AddOwner(typeof(AnchoredBlock));
///
///
///
public TextAlignment TextAlignment
{
get { return (TextAlignment)GetValue(TextAlignmentProperty); }
set { SetValue(TextAlignmentProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty LineHeightProperty =
Block.LineHeightProperty.AddOwner(typeof(AnchoredBlock));
///
/// The LineHeight property specifies the height of each generated line box.
///
[TypeConverter(typeof(LengthConverter))]
public double LineHeight
{
get { return (double)GetValue(LineHeightProperty); }
set { SetValue(LineHeightProperty, value); }
}
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty LineStackingStrategyProperty =
Block.LineStackingStrategyProperty.AddOwner(typeof(AnchoredBlock));
///
/// The LineStackingStrategy property specifies how lines are placed
///
public LineStackingStrategy LineStackingStrategy
{
get { return (LineStackingStrategy)GetValue(LineStackingStrategyProperty); }
set { SetValue(LineStackingStrategyProperty, value); }
}
#endregion Public Proterties
#region Internal Methods
///
/// This method is used by TypeDescriptor to determine if this property should
/// be serialized.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeBlocks(XamlDesignerSerializationManager manager)
{
return manager != null && manager.XmlWriter == null;
}
#endregion
//------------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
///
/// Marks this element's left edge as visible to IMEs.
/// This means element boundaries will act as word breaks.
///
internal override bool IsIMEStructuralElement
{
get
{
return true;
}
}
#endregion Internal Properties
}
}
// 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
- SessionParameter.cs
- UnwrappedTypesXmlSerializerManager.cs
- XmlNode.cs
- TextViewBase.cs
- XmlDataImplementation.cs
- CustomErrorsSection.cs
- LongValidator.cs
- XmlUnspecifiedAttribute.cs
- WindowsGraphicsCacheManager.cs
- ToolStripDropTargetManager.cs
- WindowsFormsSynchronizationContext.cs
- BufferedGraphics.cs
- AvTraceFormat.cs
- ProfilePropertyNameValidator.cs
- CreateUserWizard.cs
- DataObjectSettingDataEventArgs.cs
- ReadOnlyPermissionSet.cs
- Line.cs
- NegotiationTokenAuthenticator.cs
- AncestorChangedEventArgs.cs
- FontUnitConverter.cs
- SystemUnicastIPAddressInformation.cs
- PeerContact.cs
- EmbeddedMailObjectsCollection.cs
- TemplateBaseAction.cs
- CollectionViewGroupInternal.cs
- ReadOnlyCollection.cs
- ToolStripArrowRenderEventArgs.cs
- VoiceChangeEventArgs.cs
- CodeParameterDeclarationExpression.cs
- CodeMemberMethod.cs
- XmlSchemaAnnotated.cs
- X509Certificate2Collection.cs
- XmlLanguage.cs
- IPEndPointCollection.cs
- SchemaEntity.cs
- HotCommands.cs
- _NegoStream.cs
- SqlNotificationEventArgs.cs
- UInt16Converter.cs
- XmlSignificantWhitespace.cs
- PairComparer.cs
- CodeNamespaceImport.cs
- HttpServerVarsCollection.cs
- DataGridViewDataErrorEventArgs.cs
- AnnotationHighlightLayer.cs
- ZoneIdentityPermission.cs
- ControlValuePropertyAttribute.cs
- SqlStatistics.cs
- ReachFixedPageSerializer.cs
- BoundsDrawingContextWalker.cs
- ObjectListFieldsPage.cs
- TextServicesCompartment.cs
- HeaderedContentControl.cs
- SelectionRangeConverter.cs
- DetailsViewInsertEventArgs.cs
- Stacktrace.cs
- WinFormsSecurity.cs
- COM2Enum.cs
- XmlDomTextWriter.cs
- Input.cs
- OleDbConnectionFactory.cs
- DataServiceOperationContext.cs
- BCryptSafeHandles.cs
- ActiveXHelper.cs
- DataGridRow.cs
- PropertyMetadata.cs
- AuthenticationSection.cs
- XamlSerializerUtil.cs
- TransactionFlowProperty.cs
- GroupBox.cs
- UInt32Converter.cs
- DataMemberListEditor.cs
- TreeNodeStyle.cs
- HtmlShim.cs
- Size.cs
- TransactionFlowProperty.cs
- NonBatchDirectoryCompiler.cs
- PkcsMisc.cs
- newinstructionaction.cs
- PictureBox.cs
- GenericPrincipal.cs
- DesignerWithHeader.cs
- CryptoHandle.cs
- ResourcesGenerator.cs
- Quaternion.cs
- HttpListenerRequest.cs
- BlobPersonalizationState.cs
- ImmutableAssemblyCacheEntry.cs
- Point4D.cs
- TraceUtility.cs
- SerializerWriterEventHandlers.cs
- ProfileService.cs
- GeometryCollection.cs
- InputBuffer.cs
- SectionInformation.cs
- ZipIOLocalFileDataDescriptor.cs
- SoapAttributes.cs
- BoolExpression.cs
- ChangePassword.cs