2013-10-28 28 views
0

這裏是一個問題,因爲我想改變爲「確定」和「取消」按鈕一些文字,如何平移,確定和取消的消息框按鈕到其他語言的Windows Phone 7

,而不是「OK 「按鈕,我想在其他語言來寫,也爲取消按鈕

是這樣的:

[OK] Đồng ý 
[Cancel] Hủy 

我使用的是默認代碼:

if (MessageBox.Show("We are redirecting to our youtube channel?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) 
       { 

       } 

enter image description here

回答

0

使用,而不是實現自己的功能MessageBox類的激勵是控件的文本資源從系統在運行時拉。這意味着如果手機設置爲使用其他語言,則消息框控件將與該語言匹配。

這意味着手機將必須配置爲在越南,而不是英語,這是少了很多工作:)

對於您創建的(而不是在MessageBox串在這個例子中)串,您可以使用您需要的任何語言提供字符串的定義,然後更改手機的默認語言設置。

http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff637520(v=vs.105).aspx

1

您可以使用XNA DLL創建自定義消息框。允許的名稱空間列表在XNA Framework and Windows Phone 8 development。您需要在項目中添加Microsoft.Xna.Framework.GameServices組件。您會注意到該程序集的Guide類具有名爲BeginShowMessageBox(...)的方法。您可以使用它來自定義消息框。以下是完整的代碼。

IAsyncResult result = Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox(
"", 
"We are redirecting to our youtube channel?", 
new string[] { "Đồng ý", "Hủy" }, 
0, 
Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.None, 
null, 
null); 

result.AsyncWaitHandle.WaitOne(); 

int? choice = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(result); 
if(choice.HasValue) 
{ 
    if(choice.Value == 0) 
    { 
     //User clicks on the first button 
    } 
} 

來源:Advanced MessageBox for Windows Phone

而且您還可以創建就像一個定製的消息框,用戶控件,請Creating a Custom MessageBox for Windows Phone Applications

TCD.Controls也有CustomMessageBox。

NuGet for TCD.Controls

A Custom (Async) MessageBox for WPF and Windows Phone using TCD.Controls

+0

在Windows Phone 7的 – patel

+2

那麼你不應該使用'Windows的電話8'標籤。 – Xyroid

相關問題