This project has moved and is read-only. For the latest updates, please go here.

ChildWindow From ViewModel

Sep 9, 2011 at 3:10 PM

I hae created a child window xaml sepeare file something like


<controls:ChildWindow x:Class="Client.Views.TestChild"

TestChild(List<ExecEnqRowConverter> selectedExecsOfExecEnq)
This will call from another class view Model when user selected and click on Button....

var testChild = new TestChild(selectedExecsOfExecEnqList);

So how can I add my TestChild to Visual Tree

view: MainGrid.Children.Add(testChild );

As in MVVM I dont have MainGrid object in MainGridViewModel.cs
Sep 9, 2011 at 3:13 PM

You wouldn't create it in your ViewModel.  You would define it in your XAML.  You will need to add a DependencyProperty to your control called ItemsSource and use databinding instead of passing the collection to a constructor.

Sep 9, 2011 at 3:30 PM

Ok Thnk you very much