Hi, Telerik Team,
I'm also using PRISM4 + MEF with RadDock and have a difficulty to activate specific RadPane among many radpanes in Region,which is RadSplitContainer. For example, after user opened many radPane view in Documenthost, called MainRegion, and he clicked menu again to open radPane which is already existed in MainRegion, then the pane should be changed as selected pane.
In Prism, this is handled at region as follwoings;
Then region adaptor should deactivate other views in region. This well addressed in RadTabControlRegionAdapter which I got from this thread as followings;
private void OnSelectionChanged(object sender, RoutedEventArgs args)
{
var e = args as RadSelectionChangedEventArgs;
// e.OriginalSource == null, that's why we use sender.
if (this.hostControl == sender)
{
foreach (RadTabItem tabItem in e.RemovedItems)
{
object item = this.GetContainedItem(tabItem);
// check if the view is in both Views and ActiveViews collections (there may be out of sync)
if (this.Region.Views.Contains(item) && this.Region.ActiveViews.Contains(item))
{
this.Region.Deactivate(item);
}
}
foreach (RadTabItem tabItem in e.AddedItems)
{
object item = this.GetContainedItem(tabItem);
if (!this.Region.ActiveViews.Contains(item))
{
this.Region.Activate(item);
}
}
}
}
private void OnActiveViewsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
this.hostControl.SelectedItem = this.GetContainerForItem(e.NewItems[0], this.hostControl.Items);
}
else if (e.Action == NotifyCollectionChangedAction.Remove
&& this.hostControl.SelectedItem != null
&& e.OldItems.Contains(this.GetContainedItem((RadTabItem)this.hostControl.SelectedItem)))
{
this.hostControl.SelectedItem = null;
}
}
Would you provide kind of RadPaneGroupRegionSyncBehavior class or should I make by myself ?
or pls let me advise if simpler way is by behind code. Is this also solved with activate event of RadPane in Q2 ?
Thank you in advance.
Kang