Пример #1
0
        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);
        }
Пример #2
0
 public static Visual FindDescendantByType(Visual element, Type type)
 {
     return(VisualTreeHelperEx.FindDescendantByType(element, type, true));
 }
Пример #3
0
        public static T FindDescendantByType <T>(Visual element) where T : Visual
        {
            Visual temp = VisualTreeHelperEx.FindDescendantByType(element, typeof(T));

            return(( T )temp);
        }