Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / DependencyPropertyHelper.cs / 1305600 / DependencyPropertyHelper.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: Helper class for miscellaneous framework-level features related // to DependencyProperties. // // See spec at http://teams/sites/Avalon/Specs/GetValueSource.mht // //--------------------------------------------------------------------------- using System; namespace System.Windows { ////// Source of a DependencyProperty value. /// public enum BaseValueSource { ///The source is not known by the Framework. Unknown = BaseValueSourceInternal.Unknown, ///Default value, as defined by property metadata. Default = BaseValueSourceInternal.Default, ///Inherited from an ancestor. Inherited = BaseValueSourceInternal.Inherited, ///Default Style for the current theme. DefaultStyle = BaseValueSourceInternal.ThemeStyle, ///Trigger in the default Style for the current theme. DefaultStyleTrigger = BaseValueSourceInternal.ThemeStyleTrigger, ///Style setter. Style = BaseValueSourceInternal.Style, ///Trigger in the Template. TemplateTrigger = BaseValueSourceInternal.TemplateTrigger, ///Trigger in the Style. StyleTrigger = BaseValueSourceInternal.StyleTrigger, ///Implicit Style reference. ImplicitStyleReference = BaseValueSourceInternal.ImplicitReference, ///Template that created the element. ParentTemplate = BaseValueSourceInternal.ParentTemplate, ///Trigger in the Template that created the element. ParentTemplateTrigger = BaseValueSourceInternal.ParentTemplateTrigger, ///Local value. Local = BaseValueSourceInternal.Local, } ////// This struct contains the information returned from /// DependencyPropertyHelper.GetValueSource. /// public struct ValueSource { internal ValueSource(BaseValueSourceInternal source, bool isExpression, bool isAnimated, bool isCoerced, bool isCurrent) { // this cast is justified because the public BaseValueSource enum // values agree with the internal BaseValueSourceInternal enum values. _baseValueSource = (BaseValueSource)source; _isExpression = isExpression; _isAnimated = isAnimated; _isCoerced = isCoerced; _isCurrent = isCurrent; } ////// The base value source. /// public BaseValueSource BaseValueSource { get { return _baseValueSource; } } ////// True if the value came from an Expression. /// public bool IsExpression { get { return _isExpression; } } ////// True if the value came from an animation. /// public bool IsAnimated { get { return _isAnimated; } } ////// True if the value was coerced. /// public bool IsCoerced { get { return _isCoerced; } } ////// True if the value was set by SetCurrentValue. /// public bool IsCurrent { get { return _isCurrent; } } #region Object overrides - required by FxCop ////// Return the hash code for this ValueSource. /// public override int GetHashCode() { return _baseValueSource.GetHashCode(); } ////// True if this ValueSource equals the argument. /// public override bool Equals(object o) { if (o is ValueSource) { ValueSource that = (ValueSource)o; return this._baseValueSource == that._baseValueSource && this._isExpression == that._isExpression && this._isAnimated == that._isAnimated && this._isCoerced == that._isCoerced; } else { return false; } } ////// True if the two arguments are equal. /// public static bool operator==(ValueSource vs1, ValueSource vs2) { return vs1.Equals(vs2); } ////// True if the two arguments are unequal. /// public static bool operator!=(ValueSource vs1, ValueSource vs2) { return !vs1.Equals(vs2); } #endregion Object overrides - required by FxCop BaseValueSource _baseValueSource; bool _isExpression; bool _isAnimated; bool _isCoerced; bool _isCurrent; } ////// Helper class for miscellaneous framework-level features related /// to DependencyProperties. /// public static class DependencyPropertyHelper { ////// Return the source of the value for the given property. /// public static ValueSource GetValueSource(DependencyObject dependencyObject, DependencyProperty dependencyProperty) { if (dependencyObject == null) throw new ArgumentNullException("dependencyObject"); if (dependencyProperty == null) throw new ArgumentNullException("dependencyProperty"); dependencyObject.VerifyAccess(); bool hasModifiers, isExpression, isAnimated, isCoerced, isCurrent; BaseValueSourceInternal source = dependencyObject.GetValueSource(dependencyProperty, null, out hasModifiers, out isExpression, out isAnimated, out isCoerced, out isCurrent); return new ValueSource(source, isExpression, isAnimated, isCoerced, isCurrent); } } } // 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: Helper class for miscellaneous framework-level features related // to DependencyProperties. // // See spec at http://teams/sites/Avalon/Specs/GetValueSource.mht // //--------------------------------------------------------------------------- using System; namespace System.Windows { ////// Source of a DependencyProperty value. /// public enum BaseValueSource { ///The source is not known by the Framework. Unknown = BaseValueSourceInternal.Unknown, ///Default value, as defined by property metadata. Default = BaseValueSourceInternal.Default, ///Inherited from an ancestor. Inherited = BaseValueSourceInternal.Inherited, ///Default Style for the current theme. DefaultStyle = BaseValueSourceInternal.ThemeStyle, ///Trigger in the default Style for the current theme. DefaultStyleTrigger = BaseValueSourceInternal.ThemeStyleTrigger, ///Style setter. Style = BaseValueSourceInternal.Style, ///Trigger in the Template. TemplateTrigger = BaseValueSourceInternal.TemplateTrigger, ///Trigger in the Style. StyleTrigger = BaseValueSourceInternal.StyleTrigger, ///Implicit Style reference. ImplicitStyleReference = BaseValueSourceInternal.ImplicitReference, ///Template that created the element. ParentTemplate = BaseValueSourceInternal.ParentTemplate, ///Trigger in the Template that created the element. ParentTemplateTrigger = BaseValueSourceInternal.ParentTemplateTrigger, ///Local value. Local = BaseValueSourceInternal.Local, } ////// This struct contains the information returned from /// DependencyPropertyHelper.GetValueSource. /// public struct ValueSource { internal ValueSource(BaseValueSourceInternal source, bool isExpression, bool isAnimated, bool isCoerced, bool isCurrent) { // this cast is justified because the public BaseValueSource enum // values agree with the internal BaseValueSourceInternal enum values. _baseValueSource = (BaseValueSource)source; _isExpression = isExpression; _isAnimated = isAnimated; _isCoerced = isCoerced; _isCurrent = isCurrent; } ////// The base value source. /// public BaseValueSource BaseValueSource { get { return _baseValueSource; } } ////// True if the value came from an Expression. /// public bool IsExpression { get { return _isExpression; } } ////// True if the value came from an animation. /// public bool IsAnimated { get { return _isAnimated; } } ////// True if the value was coerced. /// public bool IsCoerced { get { return _isCoerced; } } ////// True if the value was set by SetCurrentValue. /// public bool IsCurrent { get { return _isCurrent; } } #region Object overrides - required by FxCop ////// Return the hash code for this ValueSource. /// public override int GetHashCode() { return _baseValueSource.GetHashCode(); } ////// True if this ValueSource equals the argument. /// public override bool Equals(object o) { if (o is ValueSource) { ValueSource that = (ValueSource)o; return this._baseValueSource == that._baseValueSource && this._isExpression == that._isExpression && this._isAnimated == that._isAnimated && this._isCoerced == that._isCoerced; } else { return false; } } ////// True if the two arguments are equal. /// public static bool operator==(ValueSource vs1, ValueSource vs2) { return vs1.Equals(vs2); } ////// True if the two arguments are unequal. /// public static bool operator!=(ValueSource vs1, ValueSource vs2) { return !vs1.Equals(vs2); } #endregion Object overrides - required by FxCop BaseValueSource _baseValueSource; bool _isExpression; bool _isAnimated; bool _isCoerced; bool _isCurrent; } ////// Helper class for miscellaneous framework-level features related /// to DependencyProperties. /// public static class DependencyPropertyHelper { ////// Return the source of the value for the given property. /// public static ValueSource GetValueSource(DependencyObject dependencyObject, DependencyProperty dependencyProperty) { if (dependencyObject == null) throw new ArgumentNullException("dependencyObject"); if (dependencyProperty == null) throw new ArgumentNullException("dependencyProperty"); dependencyObject.VerifyAccess(); bool hasModifiers, isExpression, isAnimated, isCoerced, isCurrent; BaseValueSourceInternal source = dependencyObject.GetValueSource(dependencyProperty, null, out hasModifiers, out isExpression, out isAnimated, out isCoerced, out isCurrent); return new ValueSource(source, isExpression, isAnimated, isCoerced, isCurrent); } } } // 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
- TransactionManager.cs
- KeyConverter.cs
- FunctionParameter.cs
- ScriptReferenceEventArgs.cs
- Debugger.cs
- MediaTimeline.cs
- ThreadStaticAttribute.cs
- WebHttpSecurity.cs
- PackageStore.cs
- EncryptedPackage.cs
- ImpersonationContext.cs
- AggregatePushdown.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- EntityTransaction.cs
- WebConfigurationFileMap.cs
- XmlILStorageConverter.cs
- SortAction.cs
- FileSystemWatcher.cs
- PhoneCall.cs
- ThreadAttributes.cs
- _Rfc2616CacheValidators.cs
- NonClientArea.cs
- DecimalConstantAttribute.cs
- LinkArea.cs
- XmlImplementation.cs
- XmlEncoding.cs
- TypeUtil.cs
- AssemblyFilter.cs
- Regex.cs
- RelatedImageListAttribute.cs
- RootAction.cs
- TemplateControlParser.cs
- HatchBrush.cs
- ReadingWritingEntityEventArgs.cs
- columnmapkeybuilder.cs
- WebPartDisplayMode.cs
- TextTreeExtractElementUndoUnit.cs
- IntellisenseTextBox.designer.cs
- FragmentQueryProcessor.cs
- StickyNoteHelper.cs
- RequestQueue.cs
- RootBuilder.cs
- DockPanel.cs
- WebPartTransformer.cs
- SmtpFailedRecipientException.cs
- ExpressionLink.cs
- GrabHandleGlyph.cs
- NameTable.cs
- ProjectionAnalyzer.cs
- storagemappingitemcollection.viewdictionary.cs
- IndexedString.cs
- HttpApplicationFactory.cs
- DbDataRecord.cs
- configsystem.cs
- NodeInfo.cs
- KeyedCollection.cs
- MetadataUtilsSmi.cs
- BitmapImage.cs
- ItemContainerProviderWrapper.cs
- EncodingInfo.cs
- ItemsPanelTemplate.cs
- BlockUIContainer.cs
- NoPersistProperty.cs
- StyleTypedPropertyAttribute.cs
- CodeObject.cs
- DetailsViewInsertedEventArgs.cs
- SafeUserTokenHandle.cs
- SourceItem.cs
- PixelFormats.cs
- DBSchemaTable.cs
- TextEffect.cs
- EntityDataReader.cs
- x509store.cs
- DesignerUtility.cs
- EntityExpressionVisitor.cs
- ModelItem.cs
- ApplicationProxyInternal.cs
- BinaryObjectInfo.cs
- ThreadExceptionEvent.cs
- ResourceAssociationType.cs
- ActionMessageFilterTable.cs
- WindowsAuthenticationModule.cs
- Set.cs
- TextBoxView.cs
- QilLiteral.cs
- ExponentialEase.cs
- TripleDESCryptoServiceProvider.cs
- SimpleWebHandlerParser.cs
- LingerOption.cs
- ResXResourceWriter.cs
- OrCondition.cs
- FullTextLine.cs
- JoinGraph.cs
- ListViewItemEventArgs.cs
- BaseValidator.cs
- GeometryDrawing.cs
- TextCharacters.cs
- HtmlTable.cs
- CroppedBitmap.cs
- Stacktrace.cs