Abdulsalam Elsharif
Abdulsalam Elsharif

Reputation: 5111

Access parent window control WPF

I have two windows:

ListItemWindow

(parent) that contain ocItems as ObservableCollection

DetailItemWindow

I called DetailItemWindow from ListItemWindow (DetailItemWindow.ShowDialog())

From DetailItemWindow How can I access to ocItems ?

Upvotes: 0

Views: 252

Answers (1)

mwilczynski
mwilczynski

Reputation: 3082

Why not pass parent Window in constructor to child Window? It doesn't violate MVVM at all, Views can know each other if they're dependant.

private ListItemWindow parent;

public DetailItemWindow(ListItemWindow window){
   this.parent = window;
}

Upvotes: 1

Related Questions