Here is a description of the control logic that has now been implemented. I think it covers all the situations developers would need but maybe you can point out possible improvements.
One of the comments to the first Krypton Navigator post pointed out a set of possible scenarios for using the navigator and a summary of features it should have in order to support them fully. As I have now implemented a first cut of the control logic I want to outline its operation.
If you think I have missed something or have ideas for improvements then I would love to hear them. Better to get the logic right now when it is painless than several months down the line.
Dynamic Page Creation
The Navigator has a property called KryptonPages that exposes a collection of KryptonPage instances. As with any standard collection you can append, insert, remove and clear the contents and use the standard collection editor to update the contents at design time. Any change to the collection is reflected in the user interface immediately in an appropriate manner.
Enabled & Disabled
You can enable for disable an individual KryptonPage by using the standard Enabled property that it exposes. The Navigator will then display it in an appropriate manner and alter user interaction as well. For example, a traditional tab appearance would show the tab header for the page in a disabled appearance and prevent the user from selecting the page by clicking the header.
Visibility
Unlike most tab controls you can also use the Visible property of the KryptonPage to hide the page. This prevents the need to remove the page from the KryptonPages collection and then add it back again later on. For example, a traditional tab appearance would completely remove display of a tab header for the page until it is made visible again. Obviously you cannot select a page that is currently hidden.
Change Events
Four events are used in the process of changing the selected page. The first two of these are called Deselecting and Selecting and can be cancelled in order to prevent the selection change. These are then followed by the Deselected and Selected events. The sequence of events would be as follows.
Deselecting sent to page about to lose selection.
Selecting sent to page about to receive selection.
Deselected sent to page that is losing selection.
Selected sent to page that is receiving selection.
The first two events allow both sides of the change to decide if they want to prevent the change from occurring. Maybe the current page wants to prevent a change until an error condition has been corrected. Maybe the target page wants to prevent itself from getting the selection until an operation has completed.
If neither side cancels the event then the switch is committed to occurring and they both get an additional event (the Deselected or Selected) to notify that the change is happening.
Finally one more event is fired at the end of the process. The SelectedPageChanged is fired whenever the SelectedPage property has a new value and this value is actually changed at the end of the process. If you only need to know when the selection changes then this is the event to hook into.
I think that covers all the scenarios developers could need. But if you know of something extra just drop me a line or a comment!



