首先,我对我的英语基础薄弱表示歉意 我想在弹出窗口中显示我的 win 表单用户控件,但这没有显示 WinFormElementHost! 我能为此做什么?
编辑:
这是我的代码,用于定义弹出窗口和我的用户控件类的 xaml 代码
<Popup Name="popupDate" PopupAnimation="Scroll" Width="310" Height="310"
PlacementTarget="{Binding ElementName=buttonDate}"
AllowsTransparency="True" Margin="8,-36,-29,-13">
<Canvas Background="Transparent">
<Canvas Background="LightBlue" Width="300" Height="300">
<Canvas.BitmapEffect>
<DropShadowBitmapEffect Softness=".3"
ShadowDepth=".5"
Color="Black"/>
</Canvas.BitmapEffect>
<WindowsFormsHost Height="200" HorizontalAlignment="Left" Margin="0,0,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="200"/>
</Canvas>
</Canvas>
</Popup>
public partial class SearchBaseDateAndDuration : UserControl
{
Persian_Calender.Persian_Calender pc;
public SearchBaseDateAndDuration()
{
InitializeComponent();
pc = new Persian_Calender.Persian_Calender();
windowsFormsHost1.Child = pc;
}
}
感谢您的关注
祝你好运
最佳答案
能否使用网格,然后将 WindowsFormsHost 和 Canvas 都放在网格中(WindowsFormHost 在上面)?
关于c# - 在 Popup 中使用 WinFormElementHost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18023905/