New to Telerik UI for WinUI? Download free 30-day trial

Disable a Segment

RadSegmentedControl allows you to disable each of its segments individually.

To disable a segment you can use the SetSegmentEnabled method. The method accepts two arguments index that determines the index of the segment. And isEnabled that determines whether the item is enabled or not.

You can also check if an item is enabled via the IsSegmentEnabled method. The method accepts a single argument - index.

Setting Disabled Segment Text Color

You can set the text color of the disabled segment through the DisabledForeground property of the Segment.

Example 1: Setting Disabled Foreground

<input:RadSegmentedControl x:Name="segmentControl" VerticalAlignment="Center" Margin="20"> 
        <Style TargetType="input:Segment"> 
            <Setter Property="DisabledForeground" Value="Green"/> 

Example 2: Disable Second Segment

public Example() 
    this.segmentControl.ItemsSource = new List<string>() { "Popular", "Library", "Playlists", "Friends" }; 
    this.segmentControl.SetSegmentEnabled(1, false); 

Figure 1: Disabled segment

WinUI SegmentedControl disable segment example

See Also

In this article
Not finding the help you need?