1
이 코드가 있습니다프로그래밍 방식으로 AppBarButton을 탭하는 방법은 무엇입니까?
async private void InformUserOfRenameOption(string platypusName)
{
CoreWindowDialog cwd = new CoreWindowDialog(String.Format(
"This platypus has been given the default name {0}. Do you want to change it?", platypusName));
cwd.Commands.Add(new UICommand { Label = "Yes", Id = 0 });
cwd.Commands.Add(new UICommand { Label = "No", Id = 1 });
cwd.Commands.Add(new UICommand { Label = "Cancel", Id = 2 });
cwd.CancelCommandIndex = 2;
IUICommand cmd = await cwd.ShowAsync();
//if (cmd.Id == 0) <= 'Operator '==' cannot be applied to operands of type 'object' and 'int'
if (Convert.ToInt32(cmd.Id) == 0)
{
appbarbtnRenamePlatypus.Tapped();
}
}
을 ...하지만 프로그래밍 방식 AppBarButton를 누릅니다 내 시도는 컴파일 타임 오류와 함께 실패합니다 "이벤트 'Windows.UI.Xaml.UIElement.Tapped'할 수있는 유일한 의 왼쪽에 표시되는 + = 또는 - = "
가 어떻게 내가 프로그래밍 방식으로 버튼이나,보다 구체적으로는 Button.Flyout 플라이 아웃이 날아 얻을를 활용할 수?
[Automation Peers] (http://msdn.microsoft.com/en-us/library/windows/apps/jj219211.aspx)를 사용할 수 있다고 생각합니다. 또는'AppBarButton'에서 확장 한 커스텀 컨트롤을 만들 수 있습니다. –