MVVMCross : MVXRegion, with and without frame for the same page

Hello,

I'm working in Xamarin UWP and I have a View which be used by two differents way. My view is called : MainView

My MainView can be used by my FirstView (with Frame) and my SecondView (WITHOUT Frame).

And this is my error : When i use my FirstView with Frame, my MainView must have MvxRegion to display my view in my frame. But when i'm in my SecondView without Frame, my MainView crash with this error :

ShowViewModel< MainViewModel >(); -> Region 'MainContent' not found in view 'UWP.Views.MainView'

How can i do that ?

MainView need to work with and without frame (with MvxRegion)

Thanks

Answers

  • LucculLuccul FRMember ✭✭

    Update :

    I'm working in Xamarin UWP and I have a View which be used by two differents way.
    My view is called : MainView

    My MainView can be used by my FrameView (with Frame) and WITHOUT Frame.

    MainView

    [MvxRegion("MainContent")]
    public sealed partial class MainView : MvxWindowsPage
    { 
        public MainView()
        {
            InitializeComponent(); 
        } 
    }
    

    FrameView have SplitView with Frame

    <SplitView.Content>
        <Frame x:Name="MainContent">
            <Frame.ContentTransitions>
                <TransitionCollection>
                    <NavigationThemeTransition>
                        <NavigationThemeTransition.DefaultNavigationTransitionInfo>
                            <EntranceNavigationTransitionInfo />
                        </NavigationThemeTransition.DefaultNavigationTransitionInfo>
                    </NavigationThemeTransition>
                </TransitionCollection>
            </Frame.ContentTransitions>
        </Frame>
    </SplitView.Content>
    

    HomeView with 2 buttons :

    One which switch to the MainView.
    And an other which switch to the FrameView which display MainView with a burger menu.

    In fact, in my HomeView i have two button, when i clic on the first, i go to the MainView with ShowViewModel<>.
    But when i clic on the second, i need to display my View in Frame (because my FrameView have a Burger menu.

    And when i click on the first i have this error :

    ShowViewModel< MainViewModel >(); -> Region 'MainContent' not found in view 'UWP.Views.MainView'

    Thanks

  • LucculLuccul FRMember ✭✭

    Not solved.

Sign In or Register to comment.