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
- HttpListener.cs
- XmlSchemaParticle.cs
- SqlConnection.cs
- XmlDeclaration.cs
- PageTextBox.cs
- MimeFormImporter.cs
- WebPartConnectionsEventArgs.cs
- WindowsFormsDesignerOptionService.cs
- FormatSettings.cs
- Transform3DCollection.cs
- QilExpression.cs
- ResourceContainer.cs
- InvalidPrinterException.cs
- ExpressionBuilderCollection.cs
- AddInContractAttribute.cs
- SizeAnimationUsingKeyFrames.cs
- TrackingAnnotationCollection.cs
- CatalogPartChrome.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- SmiRequestExecutor.cs
- InkCanvasSelection.cs
- DecimalSumAggregationOperator.cs
- DBDataPermission.cs
- BamlBinaryReader.cs
- HandleExceptionArgs.cs
- CultureTable.cs
- DataGridViewCellStyleChangedEventArgs.cs
- HtmlInputHidden.cs
- RoleExceptions.cs
- HWStack.cs
- IsolatedStorageFileStream.cs
- PlainXmlSerializer.cs
- RijndaelManagedTransform.cs
- HtmlInputSubmit.cs
- InputMethodStateChangeEventArgs.cs
- InstanceLockTracking.cs
- BStrWrapper.cs
- SchemaElementLookUpTable.cs
- ReferencedAssembly.cs
- Popup.cs
- EntityDescriptor.cs
- FocusChangedEventArgs.cs
- MsmqTransportSecurityElement.cs
- DnsElement.cs
- XmlDataSourceNodeDescriptor.cs
- CommentEmitter.cs
- MessageBox.cs
- Overlapped.cs
- DataGridViewButtonColumn.cs
- ProgressBarBrushConverter.cs
- ObjectRef.cs
- MsmqOutputSessionChannel.cs
- AppSettingsExpressionBuilder.cs
- ServicePoint.cs
- PenLineCapValidation.cs
- GridViewRow.cs
- _PooledStream.cs
- Activation.cs
- TextTreeInsertElementUndoUnit.cs
- _HeaderInfo.cs
- DefaultEventAttribute.cs
- TypeUsage.cs
- nulltextcontainer.cs
- ReferenceEqualityComparer.cs
- DataGridViewCellStyleConverter.cs
- ExtractorMetadata.cs
- PriorityChain.cs
- LeafCellTreeNode.cs
- XpsFilter.cs
- TimeSpanOrInfiniteValidator.cs
- StringAnimationBase.cs
- MediaTimeline.cs
- UIHelper.cs
- Stream.cs
- Vector3D.cs
- AlphabetConverter.cs
- RNGCryptoServiceProvider.cs
- MethodBuilderInstantiation.cs
- XamlWrappingReader.cs
- DataDesignUtil.cs
- ZipIORawDataFileBlock.cs
- HtmlTextArea.cs
- Brush.cs
- ContextMenuService.cs
- ElementUtil.cs
- ExtensionDataObject.cs
- SqlBulkCopy.cs
- CheckPair.cs
- DateTimeHelper.cs
- StateWorkerRequest.cs
- ObjectDataSourceMethodEditor.cs
- QuotaExceededException.cs
- KeyValueInternalCollection.cs
- NestedContainer.cs
- CounterCreationData.cs
- UnsafeNativeMethods.cs
- BitStack.cs
- GridPatternIdentifiers.cs
- OracleRowUpdatedEventArgs.cs
- DBSchemaTable.cs