UPDATE: you need a combination of both my answer and the HB answer. Use the version of FindChild below and change your call to FindChild to look like
var grid = FindChild<Grid>(Application.Current.RootVisual, "audioPanel");
Since you are setting up the application frame for the phone, the “control on which it is applied” from HB will most likely be RootVisual (there may be exceptions to this, I'm not sure).
, , "..." App.xaml pastebin ContentPresenter - , , .
END UPDATE
, (WPF ), audioPanel , - . , , :
public static T FindChild<T>(DependencyObject parent, string childName)
where T : DependencyObject
{
if (parent == null)
{
return null;
}
T foundChild = null;
int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < childrenCount; i++)
{
DependencyObject child = VisualTreeHelper.GetChild(parent, i);
var childType = child as T;
if (childType == null)
{
foundChild = FindChild<T>(child, childName);
if (foundChild != null)
{
break;
}
}
else if (!string.IsNullOrEmpty(childName))
{
var frameworkElement = child as FrameworkElement;
if (frameworkElement != null && frameworkElement.Name == childName)
{
foundChild = (T) child;
break;
}
foundChild = FindChild<T>(child, childName);
}
else
{
foundChild = (T) child;
break;
}
}
return foundChild;
}
}