0
我有3個圖像用鼠標按下事件是這樣的:WPF C#圖片的MouseDown切換頁面
private void button12_MouseDown(object sender, MouseButtonEventArgs e) // Back to choose story menu page.
{
//if button 2 is pressed then show FoodKing
// if button 1 is pressed then show Grasshopper
stackPanelHome.Visibility = System.Windows.Visibility.Hidden;
pageTransition1.Visibility = System.Windows.Visibility.Visible;
pageTransition1.ShowPage(What to put in here?);
}
private void button2_MouseDown(object sender, MouseButtonEventArgs e) // Food fit for a king.
{
FoodKing controlpage = new FoodKing(); // Calling user control page
stackPanelHome.Visibility = System.Windows.Visibility.Hidden;
pageTransition1.Visibility = System.Windows.Visibility.Visible;
pageTransition1.ShowPage(controlpage);
}
private void button1_MouseDown(object sender, MouseButtonEventArgs e) // Grasshopper
{
GrasshopperMenu controlpage = new GrasshopperMenu();/Calling user control page
stackPanelHome.Visibility = System.Windows.Visibility.Hidden;
pageTransition1.Visibility = System.Windows.Visibility.Visible;
pageTransition1.ShowPage(controlpage);
}
在第一頁中,有2圖標,1 FoodKing,1是草蜢那麼他們選擇哪個圖像按下並且每個圖標都有很多按鈕並通向其他位置,所以我創建了一個菜單頁面以將用戶恢復到他們在開始時選擇的頁面(FoodKing或GrassHopper)。但我如何做到這一點?看到我上面的代碼。