Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- DocumentViewerHelper.cs
- ChainedAsyncResult.cs
- CustomCredentialPolicy.cs
- LineServicesRun.cs
- MsmqIntegrationBinding.cs
- MergePropertyDescriptor.cs
- CreateUserWizard.cs
- ToolboxDataAttribute.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- ListControlBoundActionList.cs
- DataObjectAttribute.cs
- TreeViewHitTestInfo.cs
- DataComponentGenerator.cs
- CancellationTokenRegistration.cs
- WebPart.cs
- XmlRootAttribute.cs
- CacheVirtualItemsEvent.cs
- securitycriticaldataformultiplegetandset.cs
- XomlDesignerLoader.cs
- CompoundFileStorageReference.cs
- TimerEventSubscription.cs
- ToolStripMenuItem.cs
- PriorityQueue.cs
- AnonymousIdentificationModule.cs
- ResXDataNode.cs
- ScriptModule.cs
- ProtocolElement.cs
- SqlUserDefinedTypeAttribute.cs
- PathSegmentCollection.cs
- Attributes.cs
- CodeTypeReferenceExpression.cs
- ContentHostHelper.cs
- RadioButton.cs
- ControlBindingsCollection.cs
- ProcessInfo.cs
- IDReferencePropertyAttribute.cs
- MouseBinding.cs
- CodePageEncoding.cs
- SqlRowUpdatedEvent.cs
- DesignerActionKeyboardBehavior.cs
- SessionStateSection.cs
- FederatedMessageSecurityOverHttpElement.cs
- StylusPointPropertyId.cs
- LoaderAllocator.cs
- XmlDataSource.cs
- CaseStatementProjectedSlot.cs
- MsmqAppDomainProtocolHandler.cs
- CallTemplateAction.cs
- GPStream.cs
- OleDbSchemaGuid.cs
- WindowsComboBox.cs
- CompilationUtil.cs
- CodeSnippetExpression.cs
- ChooseAction.cs
- DataGridViewAccessibleObject.cs
- VectorAnimationBase.cs
- Rfc2898DeriveBytes.cs
- SetterTriggerConditionValueConverter.cs
- messageonlyhwndwrapper.cs
- LicenseManager.cs
- HostedHttpRequestAsyncResult.cs
- ClonableStack.cs
- DataListItemCollection.cs
- TextElementEnumerator.cs
- clipboard.cs
- ObjectCacheSettings.cs
- Axis.cs
- HttpAsyncResult.cs
- InkCanvasSelection.cs
- DropShadowEffect.cs
- ViewCellRelation.cs
- X509Certificate2.cs
- X509Extension.cs
- RemoteWebConfigurationHostStream.cs
- BrowserInteropHelper.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- SqlDataAdapter.cs
- DbConvert.cs
- CodeFieldReferenceExpression.cs
- HMACSHA512.cs
- WmlSelectionListAdapter.cs
- unsafenativemethodsother.cs
- ObjectDataSource.cs
- TTSEvent.cs
- Registry.cs
- UnionCodeGroup.cs
- DataBindingCollectionConverter.cs
- PrimitiveSchema.cs
- GroupItemAutomationPeer.cs
- XmlWriter.cs
- Splitter.cs
- ContentPlaceHolder.cs
- ApplicationInterop.cs
- Predicate.cs
- OdbcTransaction.cs
- TemplateEditingFrame.cs
- CommandHelpers.cs
- PanelContainerDesigner.cs
- OdbcConnectionString.cs
- AnimationLayer.cs