2014-01-08 21 views
0

我正在開發windows phone 8應用程序,此應用程序應該使用兩種語言英語和阿拉伯語。如何根據用戶在windows phone 8中選擇的語言更改消息框按鈕內容

在某些屏幕中,我顯示帶有一些消息和按鈕的消息框(確定,取消)。 當應用程序爲英文時,按鈕內容(OK和CANCEL)以英文顯示。沒事。

但是,當應用程序在阿拉伯語運行,則按鍵內容不會Arabic.It顯示正顯示出只有英文

我應該如何改變基於語言的按鈕的內容。

感謝

回答

0

您應該使用Windows Phone toolkit CustomMessageBox控制。 它可以輕鬆地本地化:

CustomMessageBox messageBox = new CustomMessageBox() 
    {     
     Caption = "Do you like this sample?", 
     Message = "There are tons of things you can do using custom message boxes. To learn more, be sure to check out the source code at Codeplex.", 
     LeftButtonContent = "yes", 
     RightButtonContent = "no", 
     IsFullScreen = (bool)FullScreenCheckBox.IsChecked 
    }; 
+0

我應該如何顯示上述消息框。 CustomMessageBox的MessageBox =新CustomMessageBox() { 標題= 「」, 消息= AppResources.SmsConfirmText, LeftButtonContent = AppResources.OkText, RightButtonContent = AppResources.CancelText, }; CustomMessageBoxResult result = messageBox.Show();請告訴我,我在最後一行發現錯誤。 – user2636874

+0

在這裏發佈錯誤。官方示例是[here](http://phone.codeplex.com/sourcecontrol/latest#PhoneToolkitSample/Samples/CustomMessageBoxSample.xaml.cs)。 – crea7or

+0

我收到此錯誤。 FullScreenCheckBox在當前上下文中找不到。 – user2636874

0

在Windows Phone 8的,您可以訪問Microsoft.Xna.Framework.GameServices其中有可以使用更靈活的消息框,無需下載單獨的圖書館。

IAsyncResult result = Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox(
    AppResources.SmsConfirmText, 
    "", 
    new string[] { AppResources.OkText, AppResources.CancelText }, 
    0, 
    Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.None, 
    null, 
    null); 

// Include following line if you want it to be synchronous 
result.AsyncWaitHandle.WaitOne(); 

int? choice = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(result); 
if(choice.HasValue) 
{ 
    if(choice.Value==0) 
    { 
     // User clicked on the first button: AppResources.OkText 
    } 
    else if(choice.Value==1) 
    { 
     // User clicked on the second button: AppResources.CancelText 
    } 
} 

來源:http://developer.nokia.com/community/wiki/Advanced_MessageBox_for_Windows_Phone

相關問題