This is a migrated thread and some comments may be shown as answers.

prevent tab switching

4 Answers 123 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 30 Oct 2009, 06:13 PM
How would I go about preventing the tab control from switching. Say I need to validate something inside some control inside the tab and if the validation fails the tab should not be allowed to switch?

4 Answers, 1 is accepted

Sort by
0
Simon yang
Top achievements
Rank 1
answered on 31 Oct 2009, 07:42 AM
Try this:
private void tab_SelectionChanged(object sender,RoutedEventArgs e)
{
       if (bisRefreshing)
          ((Telerik.Windows.Controls.RadSelectionChangedEventArgs)(e)).Handled = true;
}
0
Valentin.Stoychev
Telerik team
answered on 01 Nov 2009, 08:00 AM
Hi Adam,

With Q3.09 we are adding the PreviewSelectionChanged event for the RadTabControl. By using this event you will be able to prevent the user from selecting a particular node. The release will be live this week.

Kind regards,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Larry
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 04 Dec 2009, 10:36 PM
I am having to use the code below - which I don't think I should need:

        private void TabControl_PreviewSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)  
        {  
            RadTabItem navTo = e.AddedItems[0] as RadTabItem;  
            if (navTo.Visibility == Visibility.Collapsed)  
            {  
                e.Handled = true;  
            }  
        }  
 

When my app starts only one tab is visible.  Making choices on the main tab makes other tabs visible.  However, if the user clicks in a textbox and hits the right arrow twice they are taken to the second tab, even though it is supposed to be 'invisible'.

Thanks,

-ldl-

 

0
Kiril Stanoev
Telerik team
answered on 07 Dec 2009, 05:03 PM
Hi Larry,

Unfortunately I was not able to reproduce the issue. I have attached my sample project. Could you please take a look at it let me know the steps to reproduce the problem.


Best wishes,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TabControl
Asked by
Adam
Top achievements
Rank 1
Answers by
Simon yang
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Larry
Top achievements
Rank 1
Iron
Iron
Veteran
Kiril Stanoev
Telerik team
Share this question
or