I'm trying to put a page inside of a frame in code, it works fine when I call it from the main function. But when the button click event calls it, it does not change the frame's content. The frame within the page is already in a page in a frame if that has anything to do with it.
button click (gets called)
public void Water_icon_MouseDown(object sender, MouseButtonEventArgs e)
{
Popup_handler(Popup_type.Water);
}
the switch works how it's supposed to
public void Popup_handler(Popup_type type)
{
switch(type)
{
case Popup_type.Fertelizer:
break;
case Popup_type.Pest:
break;
case Popup_type.Water:
Popup_frame.Content = new Water_popup(main_game);
break;
case Popup_type.Air:
break;
case Popup_type.Light:
break;
}
}
Here's the frame, just in case:
<Frame x:Name="Popup_frame" Height="400" Grid.Row="1"
VerticalAlignment="Center" HorizontalAlignment="Right"
Width="1000" NavigationUIVisibility="Hidden"/>
What I have tried:
I checked the debugger and tested it separately, the page loads correctly and the inserted page works ok also. I tried the delegate because I thought it had to be something with threading, but it didn't work either. I have implemented something like this many times in this project already, but I never had this problem. Putting a different frame on the page doesn't work, changing the inserted page doesn't work either.