For some reason I cannot get the handler to trigger for the click function. When I click I get the “bing” sound as though I am doing something wrong. This is a Windows 8 app full screen. I feel as though the entire screen is disabled to mouse clicks. This is a MonoGame project which is nested inside a XAML interface. The code that controls the “Menu” of the game is as follows:
<StackPanel Height="768" VerticalAlignment="Bottom">
<ListView Name="InGameMenu" Width="300" HorizontalAlignment="Stretch" Background="Orange" Height="auto" Padding="30 0 0 0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button FontSize="40" Content="{Binding}" Click="MenuElementSelected" IsEnabled="True"></Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListView>
</StackPanel>
The elements loaded into the list are just strings. Any ideas on what might be going on? The event handler is
private void MenuElementSelected(object sender, RoutedEventArgs e)
{
Button obj = sender as Button;
switch ((string)obj.Content)
{
case "Resume":
{
_game.resume();
break;
}
case "Restart":
{
_game.restart();
break;
}
}
}
but it never even triggers a break point inside.
Any help is GREATLY appreciated!
EDIT:
The entire thing sits a SwapChainBackgroundPanel to transpose the MonoGame onto the interface. I am not sure yet, but this could be part of the issue.
So when you write a lot of code you tend to forget you have done certain things and worst of all you might miss obvious things sometimes. Reminder to all friendly programmers; pay better attention when you are trying to debug previous issues so they don’t spill over into a new issue they might of created (unnoticed). I had the following line of code:
smack at the top of the page initialization and completely missed it. Hope this helps someone else who made this silly mistake. We write thousands of lines of code on a daily basis, so things like this can happen if you are not careful enough in debugging.