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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:17:25+00:00 2026-05-24T23:17:25+00:00

I am learning WPF with M-V-VM. And I am using ICommand , RelayCommand .

  • 0

I am learning WPF with M-V-VM. And I am using ICommand, RelayCommand.
I have several Views, Models, and ViewModels.
The MainWIndowView open upon on application start. The MainWindowView has a button that opens another WPF window called “FileListview” via MainWindowViewModel.
The FileListView has a button “View Lookup”, which supposed to open another WPF window called “LookupView” via FileListViewModel. But I could not make this button to work unless I specify FileListView in App.xaml.cs instead of MainWIndowView. I could not understand why “View Lookup” button work if I make application to start from “FileListView” . I also don’t understand whether I need model for MainWindowView, and FileListView since I don’t have anything going except one view’s button is opening another view.
On code behind file “App.xaml.cs” I have

public partial class App : Application
{
  protected override void OnStartup(StartupEventArgs e)
    {
      base.OnStartup(e);
      WPFProject. MainWIndowView window = new MainWIndowView ();
      MainWIndowViewModel  VM = new MainWIndowViewModel ();
      window.DataContext = VM;
      window.Show();
    }
 }

I would appreciate if somebody can point me to good article or sample code using WPF with M-V-VM that reflect my issue.

  • 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-24T23:17:28+00:00Added an answer on May 24, 2026 at 11:17 pm

    After rethinking the issue, I was able to figure out the solution.
    The cause of the issue: I was not associating View with it’s ViewModel class.
    So I put the following code in code behind of FileListView.xaml.cs.

    public partial class FileListView: Window
    {
      private FileListViewModel  _ fileListViewModel = new FileListViewModel ();
      public FileListViewModel () 
      {
        InitializeComponent();
        base.DataContext = _fileListViewModel; 
      }
    }
    

    Thank you

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

Sidebar

Related Questions

I've been using Winforms since .NET 1.1 and I want to start learning WPF.
I'm currently learning how to write a WPF application using the MVVM pattern. I'm
I'm learning about using Caliburn.Micro as a MVVM framework for a WPF application. In
I'm just learning WPF. I'm using VS 2008. I've added an Image control to
I've been learning wpf for about a week now.. and i have a basic
I just start learning WPF, is that possible I can create an IE toolbar
I'm in the process of learning WPF coming from WinForms development. I have a
I'm still at the early stages of learning WPF and have decided to try
I have used WPF's 3D capabilities for learning, and for a few implementations, and
I have a WPF application based on PRISM that utilizes the MVVM pattern. I

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.