Hello
I have a SubMenu in a ContextMenu which ItemSource is set to a expression like
ContextMenu.Items[i].ItemsSource = DatabaseInstance.GetAllObjects()
When i handle the clicks from the ContextMenu i have this event handler: XALM:
<ContextMenu MenuItem.Click="ContextMenu_Click">
C#:
if (e.OriginalSource as MyObject == null) {
//Not MyObject. Choose action by comparing Header
}
else {
// The clicked item is a MyObject, send to another method
}
But even though the OriginalSource was created by an object of the type MyObject i always get is as a null.
How would i do this?