Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi!

I´ve a WPF application with a TabControl inside it. This TabControl has some TabItems.

I want before open one of the TabtItems (TabItemWithPassword) a password window apperars over all app. and blocks it.

In case that the user puts the correct password, the password window must close it and the app. must navigate to destination tabitem but if the user doesn´t know the password can´t navigate keeps the user in the actual TabItem.
Posted
Comments
[no name] 3-Sep-13 11:53am    
Okay.... you have permission to proceed with this.
ZurdoDev 3-Sep-13 11:57am    
Have you looked to see if that control supports what you need? Does it have an OnBeforeSelected event or something like that?
Marvin Ma 4-Sep-13 3:43am    
Are you familiar with binding?
Would be the easiest way to handle your Problem.
shelby67 13-Sep-13 2:26am    
My guess would be Data Binding like Marvin said or use some of the TabControl built in events.
Documentation: http://msdn.microsoft.com/en-us/library/system.windows.controls.tabcontrol.aspx
My guess as for the events to use:
SelectionChanged
TabItem GotFocus event: http://msdn.microsoft.com/en-us/library/system.windows.controls.tabitem.aspx
Use a dialog (window that sets a property that is attached to it and validate the password. if the password is valid and the dialog result is OK then you can either a.) add the tabitem at runtime or b.) force focus off or away from the tab you want hidden.
I did something similar recently: http://www.codeproject.com/Tips/652862/Product-Key-Dialog

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900