May 11th, 2009, 01:20 PM
TabControl and my Adorner
The main content of my app is a custom TabControl that I've re-templated and styled the heck out of. One of the design decisions of this application is that it should have no modal windows (the previous application did.) But, there are a few places where I need decisions to be made that are "modal" to the current tab in the tabcontrol. So, I wrote a custom Adorner that I lay a fake modal on top of (and disable everything behind it) so the user has to deal with that "modal" on that tab, but can still move to other tabs if their fancy strikes.
The Adorner I wrote and the controls I stick in it work great. They open and close great and I even added a fancy blur effect to the controls sitting under the modal.
The problem lies when I change tabs. I go to a different tab, then back to the tab I adorned and the blur effect is still there and the controls are all still disabled, but my adorner is gone. I used Snoop to find that the adorner seems to have been removed from the visual tree altogether. This is bad, because I still need the user to make a decision from the modal, but, as I said, the modal is now shuffled off the visual layer and nowhere to be found.
Does anyone have any words of wisdom for me here? One thing I haven't done is written my own AdornerLayer so I could have whatever sits on there persist through the tab changes, but I just didn't foresee the adorner state being cleared in this case. Would that help, I wonder?
Any help you guys could impart would be greatly appreciated.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!