Example #1
0
        /// <summary>
        /// Helper for reading AutomationId property from a StyledElement.
        /// </summary>
        public static string GetAutomationId(StyledElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            return(element.GetValue(AutomationIdProperty));
        }
Example #2
0
        /// <summary>
        /// Helper for reading AccessibilityView property from a StyledElement.
        /// </summary>
        public static AccessibilityView GetAccessibilityView(StyledElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            return(element.GetValue(AccessibilityViewProperty));
        }
Example #3
0
        /// <summary>
        /// Helper for reading AccessKey property from a StyledElement.
        /// </summary>
        public static string GetAccessKey(StyledElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            return((string)element.GetValue(AccessKeyProperty));
        }
Example #4
0
        /// <summary>
        /// Gets the value of the attached <see cref="NameScopeProperty"/> on a styled element.
        /// </summary>
        /// <param name="styled">The styled element.</param>
        /// <returns>The value of the NameScope attached property.</returns>
        public static INameScope GetNameScope(StyledElement styled)
        {
            Contract.Requires <ArgumentNullException>(styled != null);

            return(styled.GetValue(NameScopeProperty));
        }
Example #5
0
        /// <summary>
        /// Gets the value of the attached <see cref="NameScopeProperty"/> on a styled element.
        /// </summary>
        /// <param name="styled">The styled element.</param>
        /// <returns>The value of the NameScope attached property.</returns>
        public static INameScope GetNameScope(StyledElement styled)
        {
            _ = styled ?? throw new ArgumentNullException(nameof(styled));

            return(styled.GetValue(NameScopeProperty));
        }