问题描述:现有一主界面,主界面有一元素canvas,我想通过canvas的mouseenter事件,触发一个弹出窗口,如标题所述,弹出窗口使用用户控件,如何实现呢,有高人赐教没?
<Grid x:Name="LayoutRoot" Background="White">
<Canvas Width="50" Height="50" Background="Aqua"
MouseLeftButtonDown="Canvas_MouseLeftButtonDown">
</Canvas>
</Grid>
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
ChildWindow1 cwindow = new ChildWindow1();
cwindow.Show();
}
}
新建一个Silverlight子窗口ChildWindow1,然后打开它。