簡體   English   中英

在WP7中構建應用程序欄的正確方法

[英]Proper way of building application bar in WP7

我正在WP7中進行本地化的應用程序,因此我用代碼制作了應用程序欄。 當我有某種形式(注冊,登錄等)時,出現問題。 在Blend中,一切看起來都不錯,但是當我在設備上模擬帶有文本框的網格時,文本塊完全不同(有時它們彼此位於同一位置)

我的解決方案是在Blend(PhoneApplicationPage-> New(Common Properties))中構建空的應用程序欄,然后在像這樣的代碼中新建一個:

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);
        }

效果很好,但我只想確保這是正確的處理方式?

@dargod。 周圍有許多框架可以幫助構建和綁定應用欄。 許多人抱怨的應用程序欄的關鍵問題是該欄不支持即興命令,因此不適合使用MVVM。

這里有一些鏈接可能會有所幫助

AppBarUtils

可綁定的應用欄

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM