3 回答

TA貢獻(xiàn)1835條經(jīng)驗(yàn) 獲得超7個(gè)贊
這是我的解決方案:
dialog.Closing += DialogClosingEvent;
private void DialogClosingEvent(ContentDialog sender, ContentDialogClosingEventArgs args)
{
// This mean user does click on Primary or Secondary button
if(args.Result == ContentDialogResult.None)
{
args.Cancel = true;
}
}

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超9個(gè)贊
ESC如果將Form.CancelButton
屬性設(shè)置為按鈕控件(很可能是您所談?wù)摰闹靼粹o),則可以通過按下按鈕來關(guān)閉窗體對(duì)話框。
此外,如果Button.DialogResult
設(shè)置了該對(duì)話框,則按一個(gè)按鈕將關(guān)閉對(duì)話框。
您可能要檢查“主按鈕”的DialogResult屬性。
- 3 回答
- 0 關(guān)注
- 245 瀏覽
添加回答
舉報(bào)