Create ContextMenu programmatically
Hi
ContextMenu is not displayed.
Code: Select all
auto image = MakePtr<Image>();
image->SetSource(MakePtr<TextureSource>(LoadTexture(path)));
auto menu = MakePtr<ContextMenu>();
auto item = MakePtr<MenuItem>();
item->SetHeader("Hello");
item->SetText(MakePtr<TextBlock>("World"));
menu->GetItems()->Add(item);
image->SetContextMenu(menu);
image->MouseRightButtonDown() += [](BaseComponent* sender, const MouseButtonEventArgs& e) {
auto image = (Image*)sender;
auto menu = image->GetContextMenu();
menu->SetIsOpen(true);
menu->setIsEnabled(true);
menu->SetVisibility(Visibility_Visible);
};
Re: Create ContextMenu programmatically
closed
in the parent element on the right button the mouse was captured.
in the parent element on the right button the mouse was captured.
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Create ContextMenu programmatically
Thanks for the update.
Who is online
Users browsing this forum: Google [Bot] and 3 guests