Witam,
Jestem nowy na platformie .NET
Chciałbym przetłumaczyć następującą funkcję:
static TObject FindVisualParent<TObject>(UIElement child) where TObject : UIElement
{
if (child == null)
{
return null;
}
UIElement parent = VisualTreeHelper.GetParent(child) as UIElement;
while (parent != null)
{
TObject found = parent as TObject;
if (found != null)
{
return found;
}
else
{
parent = VisualTreeHelper.GetParent(parent) as UIElement;
}
}
return null;
}
na VB.NET
Chyba rozumiem jej działanie, ale czy mógłby mi ktoś odpowiedzieć na pytanie czy jest możliwe napisanie tego w VB.NET ? Chodzi mi w sumie głownie o pierwszą linijkę, czyli wykorzystanie szablonu.