private static GraphAreaBase GetAreaFromObject(object obj) { GraphAreaBase area = null; if (obj is VertexControl) { area = ((VertexControl)obj).RootArea; } else if (obj is EdgeControl) { area = ((EdgeControl)obj).RootArea; } else if (obj is DependencyObject) { area = VisualTreeHelperEx.FindAncestorByType((DependencyObject)obj, typeof(GraphAreaBase), false) as GraphAreaBase; } return(area); }
public static Visual FindDescendantByType(Visual element, Type type) { return(VisualTreeHelperEx.FindDescendantByType(element, type, true)); }
public static T FindDescendantByType <T>(Visual element) where T : Visual { Visual temp = VisualTreeHelperEx.FindDescendantByType(element, typeof(T)); return(( T )temp); }