Question

I use AvalonDock to have a vs-like docking style, and I use prism to inject views in my application.
Basically the user will have a panel on the side with one button per view loadable, and each time he presses one, I want to create a new tab on my AvalonDock's DocumentPane, and inject the right view in it.

Now I was under the impression that prism is good for this kind of scenario, but I can'f figure it out.

Also, I stumbled accross DocumentPane and DockablePane region adapters by Markus Raufer, have added it to my project and registered the mappings in the bootstrapper.
This allows me to compile the solution (so I'm guessing I'm getting close).

So far, I do this:

In my Shell I have a place with:

<avadock:DocumentPane avadock:ResizingPanel.ResizeWidth="500" Background="Transparent"
                      prism:RegionManager.RegionName="{x:Static inf:RegionNames.MainTabControlRegion}">
</avadock:DocumentPane>

In my code-behind, after Bootstrapping etc, I have a place that does:

m_RegionManager.Regions[RegionNames.MainTabControlRegion].Add(oneOfMyUserControls);

Executing this line doesn't show anything more to the user, but if i execute it twice, it will make an error saying a view is already registered (so it did add something!).

Furthermore, when i put a regular ContentControl, mark it with prism:RegionManager.RegionName="{x:Static inf:RegionNames.MainTabControlRegion} then add a UserControl in it the very same way I add it to AvalonDock's DocumentPane, it works. freaky

What am I doing wrong?
Thanks,

bab.

EDIT:
If define the MainTabControlRegion like this, the first view actually gets added, now id i add another one (different UserControl) it doesn't show it, but WPF Inspector says it's there.
From my point of view, it is indeed adding UserControls to a region, but it doesn't know how to create a new tab for each UserControl I add to the DocumentPane.
Since I'm not specifying anything about that, I'm probably missing a piece of code?

<avadock:DocumentPane avadock:ResizingPanel.ResizeWidth="500" Background="Transparent">
    <avadock:DocumentContent Title="" prism:RegionManager.RegionName="{x:Static inf:RegionNames.MainTabControlRegion}">

    </avadock:DocumentContent>
</avadock:DocumentPane>

I want it to create a new tab each time i add a usercontrol and insert it in there.

EDIT 2: Solution --> Here

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top