你好我在使用wpf用戶控制時遇到了一些問題。我在用戶控制中有單個圖像。我想把這個用戶控件放在我的主窗口上,該窗口包含一些map.i將這個用戶控件(圖像)放在我的主窗口上。他們是10 t0 15。我想要的是通過單擊此用戶控件打開不同的窗口只是一個形象。但是當我這樣做的時候,每次都會向我展示同一個窗口。有沒有什麼辦法,所以我只需要創建一個用戶控制和多次使用它來打開不同的窗口。像(窗口1,窗口2,window3)等。usercontrol打開不同的窗口c#
好心幫我。我會非常感謝。
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Demo.WindowsPresentation.CustomMarkers.CustomMarkerDemo"
Height="40" Width="30" Opacity="10">
<Image MouseDown="clickit" Name="icon" Source="bigMarkerGreen.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
在CS
this.MouseDown += new MouseButtonEventHandler(clickit);
void clickit(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("test");
main.show();
}
將一些在問題 –
您的相關代碼,我編輯我的問題。用戶控制 – ROMA
請單擊此用戶控件,還包括當前打開窗口的部分。 –