2012-08-04 73 views
1

我想更改顯示在我的應用程序中的消息框的按鈕中的文本。 因此,例如,而不是'是'我想使用'相機',而不是'不',我想用'媒體庫'..任何人有任何想法?在windows phone中更改消息框按鈕的名稱

這是多遠我得到了..

的DialogResult dlgResult = MessageBox.Show( 「運行軌跡的照片」, 「從那裏導入照片選擇」,MessageBoxButtons.YesNo,MessageBoxIcon.None);

我非常努力,任何想法都歡迎。 謝謝

回答

3

不能更改消息框的默認按鈕。更好的是,你可以在這個Microsoft Phone Toolkit這個你可以創建自定義消息框與您想要的左和右按鈕,也可以設置功能,如果這些按鈕被點擊。

要下載NuGet,點擊這裏。並在您的項目中按左鍵單擊,然後管理NuGet軟件包並搜索Microsoft Phone Toolkit,一旦您找到該軟件包,只需按安裝,然後使用我的下面的代碼。

CustomMessageBox messageBox = new CustomMessageBox() 
     { 
      Title = "Inport photo", //your title 
      Message = "Select from where to import photo", //your message 
      RightButtonContent = "Yes", // you can change this right and left button content 
      LeftButtonContent = "No", 
     }; 

     messageBox.Dismissed += (s2, e2) => 
     { 
      switch (e2.Result) 
      { 
       case CustomMessageBoxResult.RightButton: 
        //here your function for right button 
       break; 
       case CustomMessageBoxResult.LeftButton: 
        //here your function for left button 
       break; 
       default: 
       break; 
      } 
     }; 

     messageBox.Show();