Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / MeasureData.cs / 1305600 / MeasureData.cs
//---------------------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // This file defines a class intended to be passed as a parameter to Measure. It contains // available size and viewport information. // //------------------------------------------------------------------------------------- using MS.Internal; using System; using System.Windows.Media; namespace System.Windows { ////// Provides all the data we need during the Measure pass (most notably viewport information). Because of backwards /// compat we can't pass it in as a parameter to Measure so it's set as a property on UIElement directly before the call /// instead. /// internal class MeasureData { public MeasureData(Size availableSize, Rect viewport) { _availableSize = availableSize; _viewport = viewport; } public MeasureData(MeasureData data) : this (data.AvailableSize, data.Viewport) { } public bool HasViewport { get { return Viewport != Rect.Empty; } } public bool IsCloseTo(MeasureData other) { if (other == null) { return false; } bool isClose = DoubleUtil.AreClose(AvailableSize, other.AvailableSize); isClose &= DoubleUtil.AreClose(Viewport, other.Viewport); return isClose; } public Size AvailableSize { get { return _availableSize; } set { _availableSize = value; } } public Rect Viewport { get { return _viewport; } set { _viewport = value; } } private Size _availableSize; private Rect _viewport; } } // 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: // This file defines a class intended to be passed as a parameter to Measure. It contains // available size and viewport information. // //------------------------------------------------------------------------------------- using MS.Internal; using System; using System.Windows.Media; namespace System.Windows { ////// Provides all the data we need during the Measure pass (most notably viewport information). Because of backwards /// compat we can't pass it in as a parameter to Measure so it's set as a property on UIElement directly before the call /// instead. /// internal class MeasureData { public MeasureData(Size availableSize, Rect viewport) { _availableSize = availableSize; _viewport = viewport; } public MeasureData(MeasureData data) : this (data.AvailableSize, data.Viewport) { } public bool HasViewport { get { return Viewport != Rect.Empty; } } public bool IsCloseTo(MeasureData other) { if (other == null) { return false; } bool isClose = DoubleUtil.AreClose(AvailableSize, other.AvailableSize); isClose &= DoubleUtil.AreClose(Viewport, other.Viewport); return isClose; } public Size AvailableSize { get { return _availableSize; } set { _availableSize = value; } } public Rect Viewport { get { return _viewport; } set { _viewport = value; } } private Size _availableSize; private Rect _viewport; } } // 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
- WindowsEditBox.cs
- HttpDictionary.cs
- DynamicQueryableWrapper.cs
- WindowsFormsHostPropertyMap.cs
- CallbackWrapper.cs
- StringFormat.cs
- FrameworkContentElementAutomationPeer.cs
- AttributeCollection.cs
- TypeContext.cs
- BuildProvidersCompiler.cs
- SchemaMerger.cs
- ProfileService.cs
- ScriptControlDescriptor.cs
- Int64.cs
- DependencyPropertyKey.cs
- IChannel.cs
- Vector3DCollectionConverter.cs
- DefaultValueTypeConverter.cs
- SqlNodeAnnotation.cs
- FontDifferentiator.cs
- EnumerableRowCollection.cs
- IndividualDeviceConfig.cs
- ProgressBarRenderer.cs
- StopStoryboard.cs
- FormClosedEvent.cs
- DataGridViewDataErrorEventArgs.cs
- ProviderUtil.cs
- TextEditorCopyPaste.cs
- DesignConnection.cs
- ServiceModelConfigurationSectionCollection.cs
- MetadataItemSerializer.cs
- PhysicalAddress.cs
- WebPartHelpVerb.cs
- EntityTransaction.cs
- MetadataUtilsSmi.cs
- WSIdentityFaultException.cs
- CompressEmulationStream.cs
- EntityClientCacheKey.cs
- TransactionScope.cs
- BitmapEffect.cs
- UnsafeNativeMethods.cs
- ByteConverter.cs
- InProcStateClientManager.cs
- JpegBitmapDecoder.cs
- AttributeEmitter.cs
- XamlDesignerSerializationManager.cs
- SortKey.cs
- Utils.cs
- CombinedGeometry.cs
- XmlUrlEditor.cs
- SQLSingleStorage.cs
- DependencyProperty.cs
- SourceChangedEventArgs.cs
- Bezier.cs
- Visual3D.cs
- Rotation3D.cs
- TextMessageEncodingBindingElement.cs
- ProfessionalColors.cs
- CompleteWizardStep.cs
- StringReader.cs
- ThreadExceptionEvent.cs
- ValidatorCollection.cs
- HttpFileCollection.cs
- EffectiveValueEntry.cs
- metadatamappinghashervisitor.cs
- QualifiedCellIdBoolean.cs
- ProxyBuilder.cs
- PnrpPeerResolverBindingElement.cs
- ToolStrip.cs
- EntityDataSourceViewSchema.cs
- SuppressMessageAttribute.cs
- AttachedPropertyMethodSelector.cs
- WmpBitmapDecoder.cs
- XmlILIndex.cs
- TimerEventSubscription.cs
- ObsoleteAttribute.cs
- UniformGrid.cs
- XmlRawWriter.cs
- DocumentPageHost.cs
- CodeTypeReference.cs
- DeleteHelper.cs
- ModulesEntry.cs
- MsmqIntegrationElement.cs
- GridViewRow.cs
- ClientConfigPaths.cs
- HttpResponseHeader.cs
- ThreadAbortException.cs
- WebBrowserContainer.cs
- TrackingQueryElement.cs
- DeclaredTypeValidator.cs
- Pair.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- InertiaTranslationBehavior.cs
- BaseResourcesBuildProvider.cs
- CompilerGlobalScopeAttribute.cs
- PeerApplicationLaunchInfo.cs
- Separator.cs
- PersistencePipeline.cs
- CharKeyFrameCollection.cs
- HeaderedContentControl.cs