This question is locked. New answers and comments are not allowed.
Hi
I have this function to get the parent of the control. When I use it on RadGridview, the return is nothing.
Do you have any idea?
I have this function to get the parent of the control. When I use it on RadGridview, the return is nothing.
Do you have any idea?
Public Function GetParentObject(Of T As FrameworkElement)(ByVal obj As DependencyObject, Optional ByVal name As String = "") As T Dim parent As DependencyObject = VisualTreeHelper.GetParent(obj) While parent IsNot Nothing If TypeOf parent Is T AndAlso (CType(parent, T).Name = name Or String.IsNullOrEmpty(name)) Then Return CType(parent, T) parent = VisualTreeHelper.GetParent(parent) End While Return NothingEnd Function