Problem with RegionManager with custom regional adapter for DevExpress

I wrote a custom regional adapter for the DevExpress tape.

public class dxDocumentGroupRegionAdapter : RegionAdapterBase<DocumentGroup>
{
    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)
        =>
        {
            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 => regionTarget.Items.Add(x as DocumentPanel));
    }

In the xaml of my shell, I registered the area

<dxd:DocumentGroup cal:RegionManager.RegionName="RibbonTabRegion" [...]

In the code I'm importing an instance of RegionManager.On for, it requires the bootloader to call my regional adapter, but there is no region entry in my RegionManager. I also tried

RegionManager.SetRegionManager(this, rManager)

But without success. Curious that

rManager.RegisterViewWithRegion("regionName", typeof(view))

works for me, but rManager.RequestNavigate is not.

Any idea?

EDIT

I found a way to solve this problem. I have to register my region manually:

 IRegionAdapter regionAdapter = new Prism.dxDocumentGroupRegionAdapter(this.Container.GetExportedValue<IRegionBehaviorFactory>());
 IRegion region = regionAdapter.Initialize(this.documentContainer, Types.ConstantValues.MainRibbonTabRegionName);
 this.tRegionManager.Regions.Add(region);
+3
source share
1 answer

, . , , , DevX.

DevExpress DXTabControl, ( Prism) . DevExpress , . .

, devX. ( DXTabControl.

DevX Alexander, , bootstrapper ( , , , ).

http://www.devexpress.com/Support/Center/p/Q360416.aspx

, , ( ).

+1

All Articles