Popup "View" - Silverlight

Dec 20, 2008 at 7:32 AM
Edited Dec 20, 2008 at 7:40 AM
Curious if anyone had implemented Popups using CWPF and, if so, what your experiences were.  I have a design that calls for "popping" up a listbox of values related to an option selected within a control/view with multiple toggle-buttons in a region.  The reason I'm interested in a pop-up is because the designer wants the list box to be visibly anchored to and positioned relative to the selected toggle button - and the selection region/control/view shouldn't move because of inserting the listbox into or near the selection view. 

I think pop-up is the way to go because it allows me to float the box relative to the selected element, sometimes overlapping it, without having to either "reserve" other regions around the main selection control or insert them into the same region -- which would tend to cause a layout change that isn't desirable.  I'm trying to use the MVC pattern with a controller that receives a selection event from the togglebutton in the "selection" view and then calls into a presenter for the pop-up (using container resolution). 

I know this is a big "what if" but curious if view/presenter/controller is needed in this sort of scenario or if it would be better to just create a model for the data (coming from an ADO.Net data service) and then generate the pop-up in code from the selection view's presenter and then just bind the model data to a data-template. Am I abusing the framework?  Would this is also work with a legitimate region and view and I'm just not seeing it? (Composite WPF is giving me brain freeze...)

I have something that "sort-of" works but seems inelegant.  Again, just curious if anyone else had encountered anything like this and what you might suggest.
Dec 22, 2008 at 2:03 PM



Perhaps you might find the Window Region Adapter created by Ignacio Baumann useful, because it addresses a similar implementation scenario (in WPF) providing a way to show views in a separate window with a  custom style. Using a similar approach you could create a region adapter for popup regions where the injected view would be added as the Popup’s Child.


You can download the Window Region Adapter’s source code from the Composite WPF Contrib project.


And although you could bring the Popup up directly from the selection view’s presenter, in most cases it is preferable to have a clear separation of concerns to increase reusability  and extensibility.


Please let me know if this helps.


Damian Schenkelman

Dec 22, 2008 at 6:30 PM
Edited Dec 22, 2008 at 6:32 PM
Thanks.  I'll have a look and see if its fits my design.  I had already decided to implement the "pop-up" listbox as an ordinary view -- using two regions one on each side of my "selection" view.  Then I could inject the listbox containing view into either region depending on where source buton was in my selection view.  Wouldn't allow me to overlap the selection view but it'd be close.  Hopefully using a region adapter will let me get closer to my design goal...

thanks again