Windows Phone 8.1中的命令栏

时间:2015-01-19 05:47:05

标签: c# xaml windows-runtime windows-phone-8.1 commandbar

何时在Windows Phone 8.1(winprt)应用程序中使用C#制作辅助命令?

//WINRT:
CommandBar CommandBarObject = new CommandBar();
AppBarButton FirstBtn = new AppBarButton() { Icon = new BitmapIcon() { UriSource = new Uri("ms-appx:///Assets/first.png") } };
FirstBtn.Label = "First";
FirstBtn.Click += FirstBtn_Click;
FirstBtn.IsEnabled = true;

CommandBarObject.PrimaryCommands.Add(FirstBtn);
CommandBarObject.SecondaryCommands.Add(secondaryCommand);

现在如何制作 secondaryCommand

1 个答案:

答案 0 :(得分:1)

只需将 AppBarButton

放在那里
 CommandBar CommandBarObject = new CommandBar();
 AppBarButton FirstBtn = new AppBarButton() { Icon = new BitmapIcon() { UriSource = new Uri("ms-appx:///Assets/first.png") } };
 FirstBtn.Label = "First";
 FirstBtn.Click += FirstBtn_Click;
 FirstBtn.IsEnabled = true;

 AppBarButton secondaryCommand = new AppBarButton() { Label = "Second", IsEnabled = true } };
 secondaryCommand.Click += FirstBtn_Click;

 CommandBarObject.PrimaryCommands.Add(FirstBtn);
 CommandBarObject.SecondaryCommands.Add(secondaryCommand);