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
- HttpProfileBase.cs
- CmsInterop.cs
- DbDataRecord.cs
- CanonicalizationDriver.cs
- StrokeNodeData.cs
- Tuple.cs
- TraceSource.cs
- OptimalBreakSession.cs
- VerbConverter.cs
- LinkedResourceCollection.cs
- IUnknownConstantAttribute.cs
- PassportAuthenticationModule.cs
- StyleHelper.cs
- GroupByExpressionRewriter.cs
- DrawingContextWalker.cs
- ScalarConstant.cs
- DataIdProcessor.cs
- CommonDialog.cs
- DocumentCollection.cs
- SchemaObjectWriter.cs
- HtmlSelect.cs
- BinaryMethodMessage.cs
- Registry.cs
- IndexerNameAttribute.cs
- SaveCardRequest.cs
- HasCopySemanticsAttribute.cs
- SegmentInfo.cs
- SplitterPanel.cs
- TextMarkerSource.cs
- CodeDomLocalizationProvider.cs
- TabControl.cs
- DataContractAttribute.cs
- TypedMessageConverter.cs
- ListSourceHelper.cs
- BaseProcessor.cs
- TypeSemantics.cs
- TrustLevel.cs
- UnmanagedMemoryAccessor.cs
- SymmetricAlgorithm.cs
- InputProcessorProfilesLoader.cs
- DataGridTableCollection.cs
- WebServiceData.cs
- TextTrailingWordEllipsis.cs
- ColumnMapTranslator.cs
- WaitHandle.cs
- MenuItemStyle.cs
- ProxyWebPart.cs
- SmtpAuthenticationManager.cs
- WindowsFormsHelpers.cs
- Predicate.cs
- UnsafeNativeMethods.cs
- ParameterBuilder.cs
- ZipIOCentralDirectoryFileHeader.cs
- MethodBuilderInstantiation.cs
- CompletedAsyncResult.cs
- SafeFileMappingHandle.cs
- FilterEventArgs.cs
- SelectionItemProviderWrapper.cs
- HierarchicalDataBoundControl.cs
- OdbcEnvironment.cs
- EntityUtil.cs
- XmlSchemaAnnotated.cs
- CategoryAttribute.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- TaskCanceledException.cs
- PaginationProgressEventArgs.cs
- ToolStripDropDownClosedEventArgs.cs
- keycontainerpermission.cs
- SingleAnimation.cs
- SqlBulkCopyColumnMapping.cs
- Grant.cs
- SynchronizationContext.cs
- UmAlQuraCalendar.cs
- embossbitmapeffect.cs
- Metadata.cs
- Opcode.cs
- DataTableTypeConverter.cs
- XpsDocumentEvent.cs
- Calendar.cs
- DataPager.cs
- MouseWheelEventArgs.cs
- ActivationServices.cs
- DeclaredTypeElement.cs
- ComPlusServiceLoader.cs
- BatchParser.cs
- PackageRelationshipCollection.cs
- HttpProfileBase.cs
- SupportsPreviewControlAttribute.cs
- NameValueConfigurationElement.cs
- VisualBrush.cs
- DelegateArgumentValue.cs
- BindingGroup.cs
- HMACMD5.cs
- PackWebResponse.cs
- Viewport2DVisual3D.cs
- CustomAttributeBuilder.cs
- WebPartVerbCollection.cs
- ArcSegment.cs
- DesignTimeTemplateParser.cs
- ServicePointManager.cs