//We are dependent on properties provided by MainWindowViewModel so just make sure we
//have that. In production you'd want to abstract this property access away behind an
//interface or perhaps a dedicated viewmodel used to extract information from command
public interface IGetFilePathService
{
string GetFilePath(string folder);
}
public interface IDoSomethingService
{
Result GetSomething();
}<Button IsDefault="True" Click="acceptButton_Click" Command="{Binding ConfirmCommand}">OK (IsDefault=True)</Button>void acceptButton_Click(object sender, RoutedEventArgs e)
{
// Accept the dialog and return the dialog result
this.DialogResult = true;
}var vm = new DialogVM();
var customDialog = new CustomDialog {
DataContext = vm
};
customDialog.ShowDialog();
if(customDialog.DialogResult.Value)
return new Result(vm.Some);
return null;