private void radialSlider_Loaded(object sender, RoutedEventArgs e)
{
radialSlider.Loaded -= radialSlider_Loaded;
RadialList valuelabel = Utils.GetChild<RadialList>(radialSlider, "PART_LabelsRunTime"); // Retrieving the value label
RadialList valuetick = Utils.GetChild<RadialList>(radialSlider, "PART_TicksRunTime"); // Retrieving the Value tick
if (valuelabel != null)
valuelabel.Visibility = Visibility.Collapsed;
if (valuetick != null)
valuetick.Visibility = Visibility.Collapsed;
}
public class Utils {
public static T GetChild<T>(DependencyObject parent, string name) where T : DependencyObject
{
if (parent == null)
return null;
T foundChild = null;
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
var child = VisualTreeHelper.GetChild(parent, i);
T childType = child as T;
if (childType == null)
{
foundChild = GetChild<T>(child, name);
if (foundChild != null)
break;
}
else if (!string.IsNullOrEmpty(name))
{
var frameworkElement = child as FrameworkElement;
if (frameworkElement != null && frameworkElement.Name == name)
{
foundChild = (T)child;
break;
}
}
else
{
foundChild = (T)child;
break;
}
}
return foundChild;
}
}
|