System.Windows.DependencyObject.GetValue C# (CSharp) Method

GetValue() public method

public GetValue ( DependencyProperty dp ) : object
dp DependencyProperty
return object
        public object GetValue(DependencyProperty dp)
        {
            object val = properties[dp];
            return val == null ? dp.DefaultMetadata.DefaultValue : val;
        }

Usage Example

Example #1
1
        /// <summary>
        /// Gets the value of the <strong>AttachedDataContext</strong> attached property from a given 
        /// <see cref="DependencyObject"/> object.
        /// </summary>
        /// <param name="obj">The object from which to read the property value.</param>
        /// <return>The value of the <strong>AttachedDataContext</strong> attached property.</return>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="obj"/> is <see langword="null"/>.
        /// </exception>
        public static object GetAttachedDataContext(DependencyObject obj)
        {
            if (obj == null)
            throw new ArgumentNullException("obj");

              return obj.GetValue(AttachedDataContextProperty);
        }
All Usage Examples Of System.Windows.DependencyObject::GetValue