New Posts New Posts RSS Feed: DialogHost custom labels
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

DialogHost custom labels

 Post Reply Post Reply
murray.bryant View Drop Down

Joined: 11-Jan-2012
Location: Australia
Posts: 44
Post Options Post Options   Quote murray.bryant Quote  Post ReplyReply Direct Link To This Post Topic: DialogHost custom labels
    Posted: 15-May-2013 at 1:33am

I am in need of some custom labels in my dialog ( Pass,Fail,Cancel)

And I know I can achieve that with the following

var result = await _dialogManager.ShowDialogAsync(mod, new[] {"Pass", "Fail", "Cancel"});

where mod is my custom view model.

What I can't work out how to do is to be able to enable/disable the buttons within the view model.

Is this the best way to do this or is there another way?

When I tried using custom commands

 var commands = new List<IDialogUICommand<DialogResult>>();
            _passCommand = new DialogUICommand<DialogResult>("Pass", DialogResult.Ok, true, false);
            _failCommand = new DialogUICommand<DialogResult>("Fail", DialogResult.No, false, false);
            var closeCommand = new DialogUICommand<DialogResult>("Cancel", DialogResult.Cancel, false, true);
var result = await _dialogManager.ShowDialogAsync(mod, commands);

the labels did not show correctly on the buttons. Is this the better way, and if so what have I done wrong with the labels



Back to Top
mgood View Drop Down

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 15-May-2013 at 6:13am
Yes, using commands is the way to go if you want control over the labels and state of the commands. Your issue is that you are calling the wrong ShowDialogAsync method. You need to swap commands and mod. The first parameter is the list of commands, followed by the view model.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down