Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with the RegionManager with custom RegionAdapter for DevExpress
    text
    copied!<p>I wrote a custom region adapter for a DevExpress ribbon. </p> <pre><code>public class dxDocumentGroupRegionAdapter : RegionAdapterBase&lt;DocumentGroup&gt; { private DocumentGroup _instance; public dxDocumentGroupRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory) : base(regionBehaviorFactory) { } protected override IRegion CreateRegion() { return new AllActiveRegion(); } protected override void Adapt(IRegion region, DocumentGroup regionTarget) { _instance = regionTarget; regionTarget.Items.Clear(); region.ActiveViews.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler((x, y) =&gt; { switch (y.Action) { case NotifyCollectionChangedAction.Add: foreach (object __panel in y.NewItems) { if (__panel is DocumentPanel) _instance.Items.Add(__panel as DocumentPanel); else { if (__panel is UIElement) { DocumentPanel panel = new DocumentPanel(); panel.Content = __panel; _instance.Items.Add(panel); } } } break; case NotifyCollectionChangedAction.Remove: foreach (DocumentPanel __panel in y.NewItems) { _instance.Items.Remove(__panel); } break; } }); region.ActiveViews.ToList().ForEach( x =&gt; regionTarget.Items.Add(x as DocumentPanel)); } </code></pre> <p>In the xaml of my shell I registerd a region</p> <pre><code>&lt;dxd:DocumentGroup cal:RegionManager.RegionName="RibbonTabRegion" [...] </code></pre> <p>In the code behind I´m importing an instance of RegionManager.On demand the bootstrapper is calling my region adapter, but there is no entry of the region in my RegionManager. I also tried </p> <pre><code>RegionManager.SetRegionManager(this, rManager) </code></pre> <p>But without success. Curiously enough</p> <pre><code>rManager.RegisterViewWithRegion("regionName", typeof(view)) </code></pre> <p>works for me, but rManager.RequestNavigate does not. </p> <p>Any idea?</p> <p><strong>EDIT</strong></p> <p>I found a way to solve this problem. I have to register my region manually: </p> <pre><code> IRegionAdapter regionAdapter = new Prism.dxDocumentGroupRegionAdapter(this.Container.GetExportedValue&lt;IRegionBehaviorFactory&gt;()); IRegion region = regionAdapter.Initialize(this.documentContainer, Types.ConstantValues.MainRibbonTabRegionName); this.tRegionManager.Regions.Add(region); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload