/// <summary> /// Gets a named property's value, moving up the visual's parent chain if not directly on the given visual. /// </summary> /// <param name="visual">The visual on which to read the property.</param> /// <param name="property">The name of the property to get a value for.</param> /// <returns>The value of the property, or <c>null</c> if not found.</returns> public static object GetInheritedValue(this OSVisualBase visual, string property) { object value = null; visual.GetInheritedValue(property, out value); return(value); }
/// <summary> /// Gets a named property's value, moving up the visual's parent chain if not directly on the given visual. /// </summary> /// <typeparam name="T">The data type of the property.</typeparam> /// <param name="visual">The visual on which to read the property.</param> /// <param name="property">The name of the property to get a value for.</param> /// <returns>The value of the property, or its default if not found.</returns> public static T GetInheritedValue <T>(this OSVisualBase visual, string property) { var value = default(T); object rawValue = null; if (visual.GetInheritedValue(property, out rawValue)) { value = (T)rawValue; } return(value); }