Problem with region based on Selector

Topics: Prism v2 - Silverlight 2
Mar 3, 2009 at 6:24 AM
Hi,

I've got to question about region based on Selector.

1. What control is recommended to be used?
2. Now I'm using ListBox. I've created specific Template and ItemContainerStyle, so its look like ItemsControl. I need to activate and deactivate views inside this region. But after deactivation view is still visible? (I've tried ContentControl and its work fine, but i need more than one view inside region)

Thanks,
Alexey Zakharov.
Mar 4, 2009 at 3:22 PM
Activation is not the same thing as setting visible or invisible. What activation means can be something different per type of control.

A contentcontrol can only show one view at a time. So manipulating the active will make a view visible/invisible.

A selector is a control that can show multiple items, but only one of them can be selected. So activation in this case controls the selection. Consider the tabcontrol (also a selector in WPF, not in silverlight). The tabcontrol can have many views where each view get's its own tab. Setting the active view will activate the tab that hosts the view.

A listbox is a strange beast, since it can have multiple active items. 

If you don't like this behavior, you can easily create your own SelectorRegionAdapter which does not bind the items to the Region.Views collection, but to the Region.ActiveViews collection.

Hope this helps,
Erwin