Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:34:39+00:00 2026-06-08T03:34:39+00:00

I am playing around trying to build the composite parts for doing MVVM with

  • 0

I am playing around trying to build the composite parts for doing MVVM with WinRT / Metro. I have built myself ViewBase which derive’s from UserControl so I could use it to extend my views:

using System;
using System.Linq;
using Windows.UI.Xaml.Controls;
using System.Collections.Generic;

public abstract class ViewBase : UserControl
{
    /// <summary>
    /// Initializes a new instance of the ViewBase class.
    /// </summary>
    public ViewBase() : base()
    {
        BindViewModelLocatorToView(viewModelLocator: GetViewModelLocator());
    }

    /// <summary>
    /// Defines a method that returns a view model locator to be used with this class.
    /// </summary>
    protected abstract IViewModelLocator GetViewModelLocator();


    /// <summary>
    /// Defines a method that Bind's the view model provided by the view locator to the view's data context.
    /// </summary>
    private void BindViewModelLocatorToView(IViewModelLocator viewModelLocator)
    {
        if (viewModelLocator != null)
        {
            DataContext = viewModelLocator.ViewModel;
        }
    }
}

When I try to extend the UserControl I am using as a view I get an error that this partial’s parent must match the generated partial’s parent. Of course I can’t change the generated classes parent as it simply changes back on rebuild.

I notice in the sample apps included they are using the same concept with Layout aware page but I am not sure how they set the designer generated partial to match.

Does anyone know how this is done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:34:41+00:00Added an answer on June 8, 2026 at 3:34 am

    You need to change the root element in your XAML to <ns:ViewBase>, where ns is declared as the namespace your class is in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been playing around with Google Apps Script today and I am trying
I'm playing around trying to write a client for a site which provides data
This is my first time playing around with SignalR. I am trying to build
I'm currently playing around with the pre and post build events in VS2010, trying
I am playing around and trying to build a parallax website - yes, I
I am playing around with ActionScript 3 and trying to build a very simple
So, I have been playing around with Amazon Cloud (AWS) and I am trying
I have been playing around with trying to draw a 320 by 240 full
I am playing around with trying to make a simple Roguelike game to learn
Ive been playing around with delegates trying to learn and I ran into one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.