1

如何在 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

4

1 回答 1

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);
于 2015-01-19T06:22:18.523 回答