When swich from one tab item to another tab item I was expecting that the event 'TabIndex_Changed' or 'TabPostition_Changed' was fired. But nothing happened.
How can I check if a user is changing from one tab to another?
8 Answers, 1 is accepted
The TabsPositionChanged event is fired when the TabPosition property changes. The TabPosition property defines the position of the tab items relatively to the base area. The TabIndexChanged event is fired when the TabIndex property changes and basically every WinForms control has this property and this event. The TabIndex property is used to get or set the tab order of the respective control, so when you click the TAB key the focus changes from one control to another.
The event which you should use is named TabSelected. It is fired when a tab is selected either by clicking on it or programmatically using the API.
I hope this information helps.
the telerik team
But e.g. the .name property has a value of "".
So, is there a SelectedIndex property or something which will let me readout the index of the selected tab?
I should read the manual first I guess, but most of the time using the telerik suite, it is pretty straight forward.
Allthough I couldn't find event examples...
You can use the TabItem property of the TabEventArgs to get the currently selected tab item. You could also access the SelectedTab property of the TabStrip control. If you would like to get the index of the selected tab item in the tabs collection you could use the Items.IndexOf method.
the telerik team
I use this instrucction and receive the error:
"Argument '1': cannot convert from 'Telerik.WinControls.RadElement' to 'Telerik.WinControls.RadItem'"
I use your instrucction inside of the radTabStrip_TabSelected event.
Can you help me?
System.Windows.Forms.MenuItem item = new System.Windows.Forms.MenuItem();
At present you could use the GetIndex method of TabStripElement which accepts a TabItem as a parameter and returns an integer with the index in the collection of that TabItem. We will add the Index property of TabItem in our next release of RadControls for WinForms.
If you would like to get the selected tab you could handle the TabSelected event:
|TabItem item = args.TabItem as TabItem;|
|// Place your code here|
I hope that this helps. If you need any further assistance please do not hesitate to write us back.
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center