何时在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 ?
答案 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);