我想在c#windows phone 8.1中创建指定的消息对话框,但我不知道如何更改按钮文本请帮帮我!
我使用了这段代码:
MessageItem kiirat = DataHandler.DeserializeRespMessage(resp);
MessageDialog msgbox = new MessageDialog(kiirat.Text.ToString());
await msgbox.ShowAsync();
但按钮文字是否关闭,如何将其更改为同一个?
答案 0 :(得分:0)
试试这个......
MessageDialog msgDialog = new MessageDialog("message here... ", "title here");
//add ok button
UICommand okBtn = new UICommand("OK");
okBtn.Invoked = OkBtnClick;
msgDialog.Commands.Add(okBtn);
//add cancel button
UICommand cancelBtn = new UICommand("Cancel");
cancelBtn.Invoked = CancelBtnClick;
msgDialog.Commands.Add(cancelBtn);
//show message
await msgDialog.ShowAsync();
//code for cancel click
private void CancelBtnClick(IUICommand command)
{
}
//code for ok click
private void OkBtnClick(IUICommand command)
{
}