Articles in this section

How to collapse the current value label in SfRadialSlider Control?

This article describes how to collapse the current value label in the SfRadialSlider control.

The current value label of SfRadialSlider Control can be obtained from GetChild method of the VisualTreeHelper Class by passing the SfRadialSlider element name as a parameter and setting its visibility to collapsed.

The following code example demonstrates the same.

XAML

<syncfusion:SfRadialSlider x:Name="radialSlider" Loaded="radialSlider_Loaded" TickFrequency="10" Minimum="0" Maximum="100" LabelVisibility="Visible" TickVisibility="Visible" >
  <syncfusion:SfRadialSlider.LabelTemplate>
     <DataTemplate>
        <TextBlock Text="{Binding }"/>
     </DataTemplate>
  </syncfusion:SfRadialSlider.LabelTemplate>
  <TextBlock Text="{Binding ElementName=radialSlider, Path=Value}"/>            </syncfusion:SfRadialSlider>

 

C#

public partial class MainWindow : Window
  {
    public MainWindow()
      {
         InitializeComponent();
            
      }        
 
    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;
      }
  }

 

The output for the above code is shown below:

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied