2012-07-23 63 views
0

我在WP7中進行本地化應用程序,因此我在代碼中創建應用程序欄。當我有一些表單(註冊,登錄等)時會出現問題。在混合一切看起來沒事,但當我在設備上模擬它與文本框我的網格,文本塊是完全不同的(有時它們在彼此)在WP7中構建應用程序欄的正確方法

我的解決方案是在Blend(PhoneApplicationPage - > New (一般屬性)),然後使代碼的新一個這樣的:

private void BuildApplicationBar() 
     { 
      // Set the page's ApplicationBar to a new instance of ApplicationBar. 
      ApplicationBar = new ApplicationBar(); 

      // Create a new button and set the text value to the localized string from AppResources. 
      ApplicationBarIconButton OkAppBarButton = new ApplicationBarIconButton(new Uri("icons/ok.png", UriKind.Relative)); 
      OkAppBarButton.Text = AppResource.OkAppBarButton; 
      ApplicationBar.Buttons.Add(OkAppBarButton); 
      OkAppBarButton.Click += new EventHandler(OkAppBarButton_Click); 

      ApplicationBarIconButton CancelAppBarButton = new ApplicationBarIconButton(new Uri("icons/cancel.png", UriKind.Relative)); 
      CancelAppBarButton.Text = AppResource.CancelAppBarButton; 
      ApplicationBar.Buttons.Add(CancelAppBarButton); 
      CancelAppBarButton.Click += new EventHandler(CancelAppBarButton_Click); 
     } 

作品不錯,但我想只是可以肯定的是,正確的方法與處理?

回答

0

@dargod。有很多框架可以幫助構建和綁定appbar。許多人所抱怨的應用欄的關鍵問題是,該欄不支持開箱即用,因此不適用於MVVM。

這裏有一些鏈接,可以幫助

AppBarUtils

Bindable App bar

相關問題