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 6630871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:28:05+00:00 2026-05-25T22:28:05+00:00

I wrote a simple WPF Application as an example: Model: public class User {

  • 0

I wrote a simple WPF Application as an example:

Model:

public class User
{
    public String FirstName { get; set; }
    public String LastName { get; set; }
}

ViewModel:

//ViewModelBase contains base code for INotifyPropertyChanged
public class UserViewModel : ViewModelBase
{
    public UserViewModel(User user)
    {
        _user = user ?? new User();
    }

    private User _user;

    public String FirstName
    {
        get { return _user.FirstName; }
        set
        {
            if (_user.FirstName != value)
            {
                _user.FirstName = value;
                RaisePropertyChanged("FirstName", "Full Name");
            }
        }
    }

    public String LastName
    {
        get { return _user.LastName; }
        set
        {
            if (_user.LastName!= value)
            {
                _user.LastName= value;
                RaisePropertyChanged("LastName", "Full Name");
            }
        }
    }

    public String FullName
    {
        get { return String.Format("{0}, {1}", LastName, FirstName); }
    }
}

Can I reuse my code in an MVC3 app? I figure the INotifyPropertyChanged stuff won’t work, but can’t I still reuse the ViewModel somehow?

  • 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-05-25T22:28:06+00:00Added an answer on May 25, 2026 at 10:28 pm

    No, not really. ViewModels and Controllers are governed by completely different design patterns.

    Where MVVM and MVC shine is that they help break out business logic from your codebehind. You quite possibly can share your support code (code that you call from your VMs and Controllers but that isn’t touched by any platform-centric designs) and models (depending on how they are coded).

    I’m currently working on an app that combines an MVC website and a WPF application, and I do share models between them, and as much code as I can squeeze from my VMs and Controllers. But there is too much different between the two to use your VMs as Controllers and vice versa.

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

Sidebar

Related Questions

I wrote a simple VS2010 WPF application which targeted .NET Framework 4 Client Profile
I recently wrote, my first, WPF application that has a list of items that
I'm writing a WPF application with a RichTextBox and a Toolbar (a VERY simple
I'm trying to write a simple WPF app that has two ellipses, joined by
I wrote simple load testing tool for testing performance of Java modules. One problem
I wrote a simple batch file as a PowerShell script, and I am getting
I wrote a simple tool to generate a DBUnit XML dataset using queries that
I wrote a simple Windows Forms program in C#. I want to be able
I wrote a simple web service in C# using SharpDevelop (which I just got
I wrote a simple javascript image rotator which picks a random image on each

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.