Ejemplo n.º 1
0
        public static INameScope FindNameScope(this ILogical control)
        {
            Contract.Requires <ArgumentNullException>(control != null);

            return(control.GetSelfAndLogicalAncestors()
                   .OfType <StyledElement>()
                   .Select(x => (x as INameScope) ?? NameScope.GetNameScope(x))
                   .FirstOrDefault(x => x != null));
        }
Ejemplo n.º 2
0
        public static INameScope?FindNameScope(this ILogical control)
        {
            _ = control ?? throw new ArgumentNullException(nameof(control));

            var scope = control.GetSelfAndLogicalAncestors()
                        .OfType <StyledElement>()
                        .Select(x => (x as INameScope) ?? NameScope.GetNameScope(x))
                        .FirstOrDefault(x => x != null);

            return(scope);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Return a parent of the ILogical indicated
 /// </summary>
 /// <param name="Logical">The control to get its parent</param>
 /// <returns>the parent of the control</returns>
 public static T GetParentTOfLogical <T>(this ILogical logical) where T : class
 {
     return(logical.GetSelfAndLogicalAncestors().OfType <T>().FirstOrDefault <T>());
 }