Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Display Child window WPF

$
0
0

Agustin, I am, unsurprisingly, confused again, my view and view model for creating/editing/viewing a note are contained in a NoteModule. With the examples you geniuses have developed the code to fire the modal/"ChildWindow" effect your view and view models reside in the same project, selectItem method requires a reference to, or knowledge of, the SelectItemViewModel as below:

this.SelectItemRequest.Raise(new SelectItemViewModel { Title = "Items" },
    (vm) =>
    {if (vm.SelectedItem != null)
        {
            Result = "The user selected: " + vm.SelectedItem;
        }else
        {
            Result = "The user didn't select an item.";
        }
    });

If SelectItem was a View&ViewModel in a separate module how would you guys go about raising the interaction request for the view model? Also, to see if I could get the Note editor to show with the method you show, I added a reference in my Client module to my Note module and tried the following:

privatevoid OnAddNewNote()
{
    _unityContainer.RegisterInstance<NoteViewViewModel>(new NoteViewViewModel(this._dbContext, 0));this.AddNewNoteRequest.Raise(_unityContainer.Resolve<NoteViewViewModel>(),
        (cb) =>
        {int i = 0;
        });
}

 As you can see I use a UnityContainer to register and instance of my NoteViewViewModel and pass the parameters I require then raise the AddNewNoteRequest passing in the view model resolved by unity but the method fails as I have not set the Notification windows' Title property, how can I set this using the above code?

Sorry if I am totally missing something, and many thanks for your assistance with my learning curve, this architecture is a big step away from the old "code behind" days....

Thanks


Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>