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"> 
    <input:RadSegmentedControl.ItemContainerStyle> 
        <Style TargetType="input:Segment"> 
            <Setter Property="DisabledForeground" Value="Green"/> 
        </Style> 
    </input:RadSegmentedControl.ItemContainerStyle> 
</input:RadSegmentedControl> 

Example 2: Disable Second Segment

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

Figure 1: Disabled segment

SegmentedControl disable segment example

See Also

In this article
Not finding the help you need?