I'm trying to learn MVVM. I decided to create a test project right away with the right structure. For starters, I have a Views folder. In it, I separately described the main window (MVVMSample.Views.MainWindow) and the main view as usercontrol (MVVMSample.Views.MainView). Then I, like in some example found on the Internet, write the following in App.xaml.cs:
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; using MVVMSample.Views; namespace MVVMSample { public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { var window = new MainWindow(); var view = new MainView(); window.Content = view; window.Show(); } } } And in App.xaml left only:
<Application x:Class="MVVMSample.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"/> Here I have not yet created a Model or ViewModel, only View so that at least you can run the application. But the problem is, I don’t see MainView in the window at all. Those. so that I do not throw in MainView (buttons, content everyone ...) I have an empty window. What's the matter???