private static T GetTemplateChildResource <T>(FrameworkElement root, string resourceName, bool required, ref string errors) where T : class { object child = root.Resources[resourceName]; ApplyTemplateHelper.VerifyTemplateChild(typeof(T), "resource", resourceName, child, required, ref errors); return(child as T); }
private T GetTemplateChild <T>(string childName, bool required, ref string errors) where T : class { DependencyObject templateChild = base.GetTemplateChild(childName); ApplyTemplateHelper.VerifyTemplateChild(typeof(T), "template part", childName, templateChild, required, ref errors); return(templateChild as T); }