PRISM: region is not registered in RegionManager

I have a custom control that comes from User Control.

public class CustomControl : ContentControl 
{
    public static readonly DependencyProperty VisualCompareControlProperty = DependencyProperty.Register("VisualCompareControl", typeof (FrameworkElement), typeof (CustomControl), new PropertyMetadata(default(FrameworkElement)));
    public FrameworkElement VisualCompareControl
    {
        get { return (FrameworkElement) GetValue(VisualCompareControlProperty); }
        set { SetValue(VisualCompareControlProperty, value); }
    }
}

This is my "View":

<myNameSpace:CustomControl>
    <VisualCompareControl prism:RegionManager.RegionName="MyRegion" />
</myNameSpace:CustomControl>

Navigation and insertion of the View object in this region is carried out in the standard way:

RegionManager.RequestNavigate("MyRegion", navigation, navigationParameter);

When I debug the MyRegion region, it is not registered to RegionManager. How so? Any ideas?

+4
source share
1 answer

You must declare a region through a control with a declared region adapter. I assume your VisualCompareControlcontrol FrameworkElementdoes not have it.

Prism: ContentControl, ItemsControl Selector.

CustomControl ContentControl, :

<myNameSpace:CustomControl prism:RegionManager.RegionName="MyRegion" />

ContentControl:

<ContentControl prism:RegionManager.RegionName="MyRegion" />
+2

Source: https://habr.com/ru/post/1617947/


All Articles