Passing DataContext between windows in MVVM
On the main window onClick I have 

    AddNoticeAboutWrongCity addNoticeAboutWrongCity = new AddNoticeAboutWrongCity();
    addNoticeAboutWrongCity.DataContext = ((VerificationViewModule)this.DataContext).WrongCityNotice;
    addNoticeAboutWrongCity.ShowDialog();

At popup window there a lot of textboxes and two buttons

Delete object:

this.DataContext = null;

And second option "Save edited notice" which is not usable , because every change of user affection datacontext on main window,and this is demand from design department :)

I don't know why first option(it's "implementation" doesn't work. 

My ViewModel:

    class VerificationViewModule
        {
            public ObservableCollection<ReporterNotice> ReporterNotices { get; set; }
    
            public ReporterNotice OtherNotice
            {
                get
                {
                    return ReporterNotices.Where(n => n.Type == ReporterNoticeType.Other).FirstOrDefault();
                }
            }
            public ReporterNotice DuplicateNotice
            {
                get
                {
                    return ReporterNotices.Where(n => n.Type == ReporterNoticeType.Duplicate).FirstOrDefault();
                }
            }
            public ReporterNotice WrongCityNotice
            {
                get
                {
                    return ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).FirstOrDefault();
                }
                set { if(value==null)
                {
                    ReporterNotices.Remove(ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).First());
                }
                else
                {
                    if (ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).FirstOrDefault()==null)//there is always only max one instance of this type of notice
                    {
                        ReporterNotices.Add(value);
                    }
                    else
                    {
                        var c = ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).First();
                        c = value;
                            
                    }
                }}
            }
    
             public VerificationViewModule()
            {
                ObservableCollection<ReporterNotice> loadedReporterNotices = new ObservableCollection<ReporterNotice>();
                loadedReporterNotices.Add(new ReporterNotice() { Content = "Dublic", Type = ReporterNoticeType.WrongCity });
                loadedReporterNotices.Add(new ReporterNotice() { Content = "Hilton", Type = ReporterNoticeType.Duplicate });
                loadedReporterNotices.Add(new ReporterNotice() { Content = "Another notice", Type = ReporterNoticeType.Other });
                ReporterNotices = loadedReporterNotices;
            }
    
    
        }



Passing DataContext between windows in MVVM
===

On the main window onClick I have 

    AddNoticeAboutWrongCity addNoticeAboutWrongCity = new AddNoticeAboutWrongCity();
    addNoticeAboutWrongCity.DataContext = ((VerificationViewModule)this.DataContext).WrongCityNotice;
    addNoticeAboutWrongCity.ShowDialog();

At popup window there a lot of textboxes and two buttons

Delete object:

this.DataContext = null;

And second option "Save edited notice" which is not usable , because every change of user affection datacontext on main window,and this is demand from design department :)

I don't know why first option(it's "implementation" doesn't work. 

My ViewModel:

    class VerificationViewModule
        {
            public ObservableCollection<ReporterNotice> ReporterNotices { get; set; }
    
            public ReporterNotice OtherNotice
            {
                get
                {
                    return ReporterNotices.Where(n => n.Type == ReporterNoticeType.Other).FirstOrDefault();
                }
            }
            public ReporterNotice DuplicateNotice
            {
                get
                {
                    return ReporterNotices.Where(n => n.Type == ReporterNoticeType.Duplicate).FirstOrDefault();
                }
            }
            public ReporterNotice WrongCityNotice
            {
                get
                {
                    return ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).FirstOrDefault();
                }
                set { if(value==null)
                {
                    ReporterNotices.Remove(ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).First());
                }
                else
                {
                    if (ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).FirstOrDefault()==null)//there is always only max one instance of this type of notice
                    {
                        ReporterNotices.Add(value);
                    }
                    else
                    {
                        var c = ReporterNotices.Where(n => n.Type == ReporterNoticeType.WrongCity).First();
                        c = value;
                            
                    }
                }}
            }
    
             public VerificationViewModule()
            {
                ObservableCollection<ReporterNotice> loadedReporterNotices = new ObservableCollection<ReporterNotice>();
                loadedReporterNotices.Add(new ReporterNotice() { Content = "Dublic", Type = ReporterNoticeType.WrongCity });
                loadedReporterNotices.Add(new ReporterNotice() { Content = "Hilton", Type = ReporterNoticeType.Duplicate });
                loadedReporterNotices.Add(new ReporterNotice() { Content = "Another notice", Type = ReporterNoticeType.Other });
                ReporterNotices = loadedReporterNotices;
            }
    
    
        }


