Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Documents / Floater.cs / 1 / Floater.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: Floater element. // //--------------------------------------------------------------------------- using System.ComponentModel; using MS.Internal; using MS.Internal.PtsHost.UnsafeNativeMethods; // PTS restrictions namespace System.Windows.Documents { ////// Floater element /// public class Floater : AnchoredBlock { //------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------- #region Constructors ////// Static ctor. Initializes property metadata. /// static Floater() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Floater), new FrameworkPropertyMetadata(typeof(Floater))); } ////// Initialized the new instance of a Floater /// public Floater() : this(null, null) { } ////// Initialized the new instance of a Floater specifying a Block added /// to a Floater as its first child. /// /// /// Block added as a first initial child of the Floater. /// public Floater(Block childBlock) : this(childBlock, null) { } ////// Creates a new Floater instance. /// /// /// Optional child of the new Floater, may be null. /// /// /// Optional position at which to insert the new Floater. May /// be null. /// public Floater(Block childBlock, TextPointer insertionPosition) : base(childBlock, insertionPosition) { } #endregion Constructors //-------------------------------------------------------------------- // // Public Properties // //------------------------------------------------------------------- #region Public Properties ////// DependencyProperty for public static readonly DependencyProperty HorizontalAlignmentProperty = FrameworkElement.HorizontalAlignmentProperty.AddOwner( typeof(Floater), new FrameworkPropertyMetadata( HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsMeasure)); ///property. /// /// /// public HorizontalAlignment HorizontalAlignment { get { return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty); } set { SetValue(HorizontalAlignmentProperty, value); } } ////// DependencyProperty for public static readonly DependencyProperty WidthProperty = DependencyProperty.Register( "Width", typeof(double), typeof(Floater), new FrameworkPropertyMetadata( Double.NaN, FrameworkPropertyMetadataOptions.AffectsMeasure), new ValidateValueCallback(IsValidWidth)); ///property. /// /// The Width property specifies the width of the element. /// [TypeConverter(typeof(LengthConverter))] public double Width { get { return (double)GetValue(WidthProperty); } set { SetValue(WidthProperty, value); } } #endregion Public Properties //-------------------------------------------------------------------- // // Private Methods // //-------------------------------------------------------------------- #region Private Methods private static bool IsValidWidth(object o) { double width = (double)o; double maxWidth = Math.Min(1000000, PTS.MaxPageSize); if (Double.IsNaN(width)) { // Default value of width is NaN return true; } if (width < 0 || width > maxWidth) { return false; } return true; } #endregion Private Methods } } // 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: Floater element. // //--------------------------------------------------------------------------- using System.ComponentModel; using MS.Internal; using MS.Internal.PtsHost.UnsafeNativeMethods; // PTS restrictions namespace System.Windows.Documents { ////// Floater element /// public class Floater : AnchoredBlock { //------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------- #region Constructors ////// Static ctor. Initializes property metadata. /// static Floater() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Floater), new FrameworkPropertyMetadata(typeof(Floater))); } ////// Initialized the new instance of a Floater /// public Floater() : this(null, null) { } ////// Initialized the new instance of a Floater specifying a Block added /// to a Floater as its first child. /// /// /// Block added as a first initial child of the Floater. /// public Floater(Block childBlock) : this(childBlock, null) { } ////// Creates a new Floater instance. /// /// /// Optional child of the new Floater, may be null. /// /// /// Optional position at which to insert the new Floater. May /// be null. /// public Floater(Block childBlock, TextPointer insertionPosition) : base(childBlock, insertionPosition) { } #endregion Constructors //-------------------------------------------------------------------- // // Public Properties // //------------------------------------------------------------------- #region Public Properties ////// DependencyProperty for public static readonly DependencyProperty HorizontalAlignmentProperty = FrameworkElement.HorizontalAlignmentProperty.AddOwner( typeof(Floater), new FrameworkPropertyMetadata( HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsMeasure)); ///property. /// /// /// public HorizontalAlignment HorizontalAlignment { get { return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty); } set { SetValue(HorizontalAlignmentProperty, value); } } ////// DependencyProperty for public static readonly DependencyProperty WidthProperty = DependencyProperty.Register( "Width", typeof(double), typeof(Floater), new FrameworkPropertyMetadata( Double.NaN, FrameworkPropertyMetadataOptions.AffectsMeasure), new ValidateValueCallback(IsValidWidth)); ///property. /// /// The Width property specifies the width of the element. /// [TypeConverter(typeof(LengthConverter))] public double Width { get { return (double)GetValue(WidthProperty); } set { SetValue(WidthProperty, value); } } #endregion Public Properties //-------------------------------------------------------------------- // // Private Methods // //-------------------------------------------------------------------- #region Private Methods private static bool IsValidWidth(object o) { double width = (double)o; double maxWidth = Math.Min(1000000, PTS.MaxPageSize); if (Double.IsNaN(width)) { // Default value of width is NaN return true; } if (width < 0 || width > maxWidth) { return false; } return true; } #endregion Private Methods } } // 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
- QueryRewriter.cs
- XmlSchemaAnnotation.cs
- Base64Encoder.cs
- DocumentApplication.cs
- TrackingProfileDeserializationException.cs
- BinHexEncoder.cs
- SQLString.cs
- HandleCollector.cs
- AttributeProviderAttribute.cs
- EntityRecordInfo.cs
- SecureEnvironment.cs
- ImportContext.cs
- PlatformNotSupportedException.cs
- SqlUdtInfo.cs
- TraversalRequest.cs
- UniqueEventHelper.cs
- MasterPageBuildProvider.cs
- CollectionViewGroupInternal.cs
- HitTestResult.cs
- LineServices.cs
- ActivityValidator.cs
- TextSelectionHighlightLayer.cs
- BuildResult.cs
- StylusButtonEventArgs.cs
- QueryableFilterRepeater.cs
- FontClient.cs
- ObjectViewListener.cs
- RegexStringValidatorAttribute.cs
- ResourceReferenceExpression.cs
- SecurityTokenInclusionMode.cs
- DialogWindow.cs
- LifetimeServices.cs
- HostedElements.cs
- DateTime.cs
- Rfc2898DeriveBytes.cs
- ReadOnlyCollection.cs
- HttpCapabilitiesEvaluator.cs
- BinaryCommonClasses.cs
- MetricEntry.cs
- Switch.cs
- SynchronizedInputPattern.cs
- TemplateAction.cs
- VisualTransition.cs
- UnsafeNativeMethods.cs
- WindowsAuthenticationEventArgs.cs
- TypeInitializationException.cs
- PrivilegeNotHeldException.cs
- TraceListeners.cs
- XmlTypeAttribute.cs
- Registry.cs
- Rotation3DAnimation.cs
- ZipIOExtraFieldZip64Element.cs
- PermissionSetTriple.cs
- HideDisabledControlAdapter.cs
- WindowShowOrOpenTracker.cs
- ClientConfigurationHost.cs
- ButtonColumn.cs
- ReadOnlyAttribute.cs
- SettingsPropertyValue.cs
- DataGridLinkButton.cs
- UnionCqlBlock.cs
- IIS7WorkerRequest.cs
- SoapEnumAttribute.cs
- FixedDocument.cs
- Collection.cs
- XmlDocumentSerializer.cs
- TimersDescriptionAttribute.cs
- Style.cs
- DataObjectAttribute.cs
- CodeMethodMap.cs
- Zone.cs
- Animatable.cs
- CodeTypeOfExpression.cs
- SQLInt32.cs
- CommandField.cs
- SemaphoreSlim.cs
- RenderTargetBitmap.cs
- GiveFeedbackEventArgs.cs
- SqlAliasesReferenced.cs
- SpellerHighlightLayer.cs
- XomlCompilerHelpers.cs
- WindowsAltTab.cs
- LineServices.cs
- SoapDocumentMethodAttribute.cs
- Separator.cs
- FormatterServices.cs
- ItemsChangedEventArgs.cs
- _Events.cs
- ResourceProperty.cs
- SqlUtils.cs
- ContainerTracking.cs
- AsyncOperation.cs
- MDIWindowDialog.cs
- BufferedStream.cs
- QilXmlReader.cs
- CustomPopupPlacement.cs
- RowSpanVector.cs
- WebPartMinimizeVerb.cs
- UnknownMessageReceivedEventArgs.cs
- PropertyEmitter.cs