Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- WebSysDefaultValueAttribute.cs
- PropertyGridEditorPart.cs
- SecurityTokenValidationException.cs
- TypefaceMetricsCache.cs
- MatchAttribute.cs
- OutputScope.cs
- DomainConstraint.cs
- Transactions.cs
- _OSSOCK.cs
- PeerCollaborationPermission.cs
- ColumnMapProcessor.cs
- BitmapEffectDrawing.cs
- SqlDataSourceConnectionPanel.cs
- ComponentChangingEvent.cs
- TypeKeyValue.cs
- LingerOption.cs
- SwitchExpression.cs
- EventProxy.cs
- Predicate.cs
- UInt32Converter.cs
- OdbcFactory.cs
- RegexStringValidator.cs
- AsyncMethodInvoker.cs
- InternalConfigHost.cs
- DataTableMappingCollection.cs
- DataAdapter.cs
- SqlDataSourceStatusEventArgs.cs
- ToolStripOverflow.cs
- DbReferenceCollection.cs
- RequestCache.cs
- LayoutDump.cs
- ListItemsPage.cs
- PerfCounters.cs
- DocumentOrderComparer.cs
- CssTextWriter.cs
- ParseHttpDate.cs
- InputElement.cs
- CompilerTypeWithParams.cs
- CodeDelegateInvokeExpression.cs
- StyleBamlRecordReader.cs
- SerializationStore.cs
- XmlWriter.cs
- TdsParserHelperClasses.cs
- Vars.cs
- ThousandthOfEmRealDoubles.cs
- ScriptHandlerFactory.cs
- XslVisitor.cs
- OrderByBuilder.cs
- HtmlButton.cs
- NetworkInformationException.cs
- SecurityState.cs
- DateTimeSerializationSection.cs
- ThreadAbortException.cs
- String.cs
- UTF8Encoding.cs
- MultipartContentParser.cs
- TreeViewEvent.cs
- CodeSubDirectory.cs
- RealProxy.cs
- ModelItemDictionary.cs
- SymmetricKeyWrap.cs
- TextTreeText.cs
- BinaryObjectInfo.cs
- Table.cs
- Soap12ProtocolReflector.cs
- BounceEase.cs
- ReflectPropertyDescriptor.cs
- Span.cs
- SqlCommandSet.cs
- ShimAsPublicXamlType.cs
- HelpEvent.cs
- ControlCollection.cs
- Merger.cs
- OleDbCommandBuilder.cs
- TableItemStyle.cs
- ProvideValueServiceProvider.cs
- Matrix3D.cs
- Pair.cs
- GatewayIPAddressInformationCollection.cs
- FaultDescription.cs
- ProgressBarRenderer.cs
- LinqDataSourceContextData.cs
- HandlerFactoryWrapper.cs
- TreeViewDataItemAutomationPeer.cs
- XsdDuration.cs
- ErrorsHelper.cs
- AnimatedTypeHelpers.cs
- StaticDataManager.cs
- AmbientValueAttribute.cs
- ContractBase.cs
- ThreadBehavior.cs
- OperationFormatter.cs
- MSAAWinEventWrap.cs
- EditingScope.cs
- ADRole.cs
- CharEnumerator.cs
- EdmItemCollection.cs
- Constraint.cs
- ScriptReferenceEventArgs.cs
- Journaling.cs