In WPF (MVVM) when I create new instance of window (view) it has no entry data - but when I enter some data, close window and reopen it contains the same data as window was closed with. How to provide "fresh" window (with blank fields which need to be fulfilled) instance each time?
I've tried many things and right now my class "ViewService" looks like this.
public class ViewService : IViewService
{
public void Show<T>()
{
try
{
T window = Activator.CreateInstance<T>();
var view = window as Window;
view.Show();
}
catch (Exception)
{
}
}
public void ShowDialog<T>()
{
try
{
T window = Activator.CreateInstance<T>();
var view = window as Window;
view.ShowDialog();
}
catch (Exception)
{
}
}
Thank you very much for your help.
PS. I use SimpleIoC container to register viewmodels.