This is my App.xaml.cs I am getting two windows of the application; one is blank and one with desired o/p (i.e with the binding of ViewModelAdd) please tell me how to get only one start up window is this related to StartupUri in app.xaml?
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using MyFirstExample.ViewModel;
namespace MyFirstExample
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MainWindow w = new MainWindow();
ViewModelAdd VM = new ViewModelAdd();
w.DataContext = VM;
w.Show();
}
}
}
App.xaml
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>