modal dialogwhere the user can search for albums to buy.
Viewsfolder and select
Class / Interfacethe following class names:
MainWindowViewModel.csand add the following code:
ShowDialoginteraction. Notice that the
System.Reactive.Linqnamespace is added to the top and the BuyMusicCommand is changed to use
MainWindow.xaml.csyou may need to expand the
MainWindow.axamlfile in to see this file.
ReactiveWindow<MainWindowViewModel>instead of just
DoShowDialogAsyncmethod like so:
DataContextto interaction.Input, which is the instance of the
await dialog.ShowDialog<AlbumViewModel?>(this)on the dialog, passing
thisas an argument, showing that the
MainWindowcurrently represented by
thispointer will be the
nullif the dialog is cancelled.
interaction.SetOutput (result)is then called. This causes the interaction to end, and the program will return to our
MainWindowViewModelwhere we left of at the call to
var result = await ShowDialog.Handle(store);.
WhenActivatedcall to the Windows constructor.
Actionthat takes a
disposable, this means that ReactiveUI will clean up any subscriptions when this View is not on the screen for us.
MainWindow.xaml.csshould now look like:
MainWindow.axamland set the property
MainWindowwill be positioned in the center of the users monitor when the program loads, and that the dialog window will be positioned in the center of the
MainWindowthat owns it.
Heightproperties of the
<Window>element to 1000 and 550 respectively.