Events
This article lists the events specific for the RadTabControl control.
-
PreviewTabClosed: Occurs when a RadTabItem is about to be closed. The event arguments are of type PreviewTabChangedEventArgs and provide access to the following properties:
TabItem: The RadTabItem that has been changed.
-
DataContext: The DataContext of the changed RadTabItem.
Example 1: PreviewTabClosed Event Handler
private void TabControl_PreviewTabClosed(object sender, Telerik.Windows.Controls.PreviewTabChangedEventArgs e) { if (e.TabItem.Header.ToString() == "Tab 1") { e.Cancel = true; } }
Private Sub TabControl_PreviewTabClosed(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.PreviewTabChangedEventArgs) If e.TabItem.Header.ToString() = "Tab 1" Then e.Cancel = True End If End Sub
-
TabClosed: Occurs when a RadTabItem is closed. The event arguments are of type TabChangedEventArgs and expose the following members:
TabItem: The RadTabItem that has been changed.
DataContext: The DataContext of the changed TabItem.
-
PreviewTabUnpinned: Occurs when a RadTabItem is about to be unpinned. Event arguments are of of type PreviewTabChangedEventArgs.
Example 2: PreviewTabUnpinned Event Handler
private void RadTabControl_PreviewTabUnpinned(object sender, Telerik.Windows.Controls.PreviewTabChangedEventArgs e) { MessageBox.Show($"{e.TabItem.Header} is about to be unpinned."); }
Private Sub RadTabControl_PreviewTabUnpinned(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.PreviewTabChangedEventArgs) MessageBox.Show($"{e.TabItem.Header} is about to be unpinned.") End Sub
TabUnpinned: Occurs when a RadTabItem is unpinned. The event arguments are of type TabChangedEventArgs.
-
PreviewTabPinned: Occurs when a RadTabItem is about to be pinned. The event arguments are of type PreviewTabChangedEventArgs.
Example 3: PreviewTabPinned Event Handler
private void RadTabControl_PreviewTabPinned(object sender, Telerik.Windows.Controls.PreviewTabChangedEventArgs e) { e.Cancel = true; }
Private Sub RadTabControl_PreviewTabPinned(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.PreviewTabChangedEventArgs) e.Cancel = True End Sub
TabPinned: Occurs when a RadTabItem is pinned. The event arguments are of type TabChangedEventArgs.
-
DropDownOpened: An event that is raised when the Telerik.Windows.Controls.TabControl.DropDownMenu is opened. This is a RoutedEvent. The event arguments are of type DropDownEventArgs and expose the following members:
DropDownItemsSource: Gets or sets the items collection for the drop down context menu.
-
RoutedEvent: Gets or sets the RoutedEventAgs.RoutedEvent associated with this RoutedEventArgs instance.
Example 4: DropDownOpened Routed Event
private void RadTabControl_DropDownOpened(object sender, DropDownEventArgs e) { List<string> dropDownItems = e.DropDownItemsSource.Cast<string>().ToList<string>(); dropDownItems.Add("New DropDown Item."); e.DropDownItemsSource = dropDownItems; }
Private Sub RadTabControl_DropDownOpened(ByVal sender As Object, ByVal e As DropDownEventArgs) Dim dropDownItems As List(Of String) = e.DropDownItemsSource.Cast(Of String)().ToList(Of String)() dropDownItems.Add("New DropDown Item.") e.DropDownItemsSource = dropDownItems End Sub
DropDownClosed: This event is raised when the Telerik.Windows.Controls.TabControl.DropDownMenu is closed. This is a RoutedEvent. The event arguments are of type DropDownEventArgs.
-
ItemReordered: This event occurs when an item is reordered while dragging. This is a RoutedEvent. In order for this event to be raised, the AllowDragReorder property needs to be set to True. The event arguments are of type ItemReorderedEventArgs and expose the following members:
OldIndex: Gets the previous index of the dragged item.
NewIndex: Gets the next index of the dragged item.