Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / DependencyPropertyHelper.cs / 1 / 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) { // 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; } ////// 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; } } #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; } ////// 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; BaseValueSourceInternal source = dependencyObject.GetValueSource(dependencyProperty, null, out hasModifiers, out isExpression, out isAnimated, out isCoerced); return new ValueSource(source, isExpression, isAnimated, isCoerced); } } } // 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) { // 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; } ////// 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; } } #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; } ////// 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; BaseValueSourceInternal source = dependencyObject.GetValueSource(dependencyProperty, null, out hasModifiers, out isExpression, out isAnimated, out isCoerced); return new ValueSource(source, isExpression, isAnimated, isCoerced); } } } // 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
- TrackingRecord.cs
- XmlNodeList.cs
- ContainerVisual.cs
- SafeFindHandle.cs
- ViewSimplifier.cs
- DocumentXmlWriter.cs
- SharedTcpTransportManager.cs
- RayMeshGeometry3DHitTestResult.cs
- OleDbTransaction.cs
- ListenerHandler.cs
- DBConnection.cs
- KeySplineConverter.cs
- RelationshipWrapper.cs
- PEFileEvidenceFactory.cs
- InputDevice.cs
- MatrixTransform.cs
- FlowDocumentFormatter.cs
- CodeBlockBuilder.cs
- GridErrorDlg.cs
- ModelPropertyImpl.cs
- XmlC14NWriter.cs
- MethodImplAttribute.cs
- _NegoState.cs
- RuntimeVariablesExpression.cs
- Mouse.cs
- WmlCommandAdapter.cs
- GroupByExpressionRewriter.cs
- RuleSettingsCollection.cs
- BinaryMessageEncodingBindingElement.cs
- SqlServices.cs
- ProfilePropertySettingsCollection.cs
- IODescriptionAttribute.cs
- ColorPalette.cs
- AsyncResult.cs
- SerialErrors.cs
- ConfigurationManagerInternalFactory.cs
- _NtlmClient.cs
- StatusBar.cs
- WindowPattern.cs
- FileFormatException.cs
- MonthCalendar.cs
- CustomPopupPlacement.cs
- SqlUnionizer.cs
- DataTableReader.cs
- FormViewDeletedEventArgs.cs
- MenuItemBindingCollection.cs
- FixedSOMContainer.cs
- Binding.cs
- DrawListViewItemEventArgs.cs
- CustomAttributeBuilder.cs
- SqlCommandBuilder.cs
- TargetException.cs
- JavaScriptString.cs
- Brush.cs
- XamlSerializerUtil.cs
- SessionStateItemCollection.cs
- StringSource.cs
- ExpressionBuilder.cs
- EntitySqlQueryBuilder.cs
- CodeAttributeDeclarationCollection.cs
- AlignmentYValidation.cs
- CompleteWizardStep.cs
- Events.cs
- MdiWindowListItemConverter.cs
- SafeSecurityHandles.cs
- RegexRunnerFactory.cs
- SmtpAuthenticationManager.cs
- RIPEMD160Managed.cs
- Cursors.cs
- Emitter.cs
- BindUriHelper.cs
- SchemaImporterExtensionElement.cs
- StylusPointPropertyInfo.cs
- AuthStoreRoleProvider.cs
- StateItem.cs
- KnownTypesHelper.cs
- assertwrapper.cs
- ScriptReferenceBase.cs
- AuthStoreRoleProvider.cs
- DataSourceControl.cs
- SQLMembershipProvider.cs
- CommandField.cs
- Paragraph.cs
- DrawingAttributeSerializer.cs
- OutputBuffer.cs
- TargetException.cs
- XmlSchemaInfo.cs
- DependencyPropertyValueSerializer.cs
- SamlAssertionKeyIdentifierClause.cs
- AuthenticationConfig.cs
- Soap12ServerProtocol.cs
- FontStretches.cs
- ScriptModule.cs
- ClientSession.cs
- EventLogPermissionEntryCollection.cs
- XmlSchemaInclude.cs
- TypeUtils.cs
- Profiler.cs
- DefaultMergeHelper.cs
- HtmlTableRow.cs