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

Selection

RadRibbonView supports single RadRibbonTab selection. You can select it either run-time by clicking with your mouse on the appropriate tab header or programmatically via the properties described below.

You can access the RadRibbonView control through an alias pointing to the Telerik.UI.Xaml.Controls namespace: xmlns:telerik="using:Telerik.UI.Xaml.Controls"

Properties

  • RadRibbonView Selection Properties

    • SelectedItem: A property of type object that gets or sets the currently selected ribbon tab item.

      If the RadRibbonView control is bound to a custom collection, then the property SelectedItem will not return RadRibbonTab as you might expect, but item of the type the source collection contains.

    • SelectedIndex: A property of type int that gets or sets the index of the currently selected ribbon tab item.

  • RadRibbonTab Selection Properties

    • IsSelected: A boolean property that specify if given tab is selected. If you want to make a tab selected, just set this property to True otherwise set it to False.

Events

  • PreviewSelectionChanged: Event raised when the tab selection is about to be done. The event arguments are of type RadSelectionChangedEventArgs and expose the following members:

    • AddedItems: An IList collection of the selected items.
    • RemovedItems: An IList collection of the unselected items.

    You can cancel the selection by setting the RadSelectionChangedEventArgs's Handled property to True.

  • SelectionChanged: Event raised after the tab selection is done. The event arguments are of type RadSelectionChangedEventArgs and expose the following members:

    • AddedItems: An IList collection of the selected items.
    • RemovedItems: An IList collection of the unselected items.

This code snippet shows you how to attach to the selection events:

Example 1: Subscribe to Preview/SelectionChanged event

<telerik:RadRibbonView x:Name="radRibbonView" PreviewSelectionChanged="radRibbonView_PreviewSelectionChanged" SelectionChanged="radRibbonView_SelectionChanged"> 
... 
</telerik:RadRibbonView> 
Below is a sample implementation of both of the event handlers:

Example 2: Event Handlers

private void radRibbonView_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e) 
{ 
    // Custom code 
    // Cancel the selection 
    e.Handled = true; 
} 
private void radRibbonView_SelectionChanged(object sender, RadSelectionChangedEventArgs e) 
{ 
    //Get the selected items 
    IList selectedItems = e.AddedItems; 
    //Get the unselected items 
    IList unselectedItems = e.RemovedItems; 
} 
In this article
Not finding the help you need?