[英]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。
这里有一些链接可能会有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.