3
首先,我爲我的英語基礎薄弱道歉 我想在彈出窗口中顯示我的win窗體用戶控件,但未顯示WinFormElementHost! 我能爲此做些什麼?在彈出窗口中使用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;
}
}
感謝您的關注
好運
你可以分享失敗嘗試的任何代碼 – KyleMit
這段代碼沒有任何錯誤,但不顯示我的用戶控件,而且我使用彈出式菜單很容易 –
我不明白你應該如何工作。必須有某種WinForms控件_inside_'WindowsFormsHost' XAML標籤。看到這裏'DataGridView' http://mindstick.com/Articles/e87470a2-1aac-4d2a-a645-f3d9e90ba555/?WindowsFormsHost%20control%20in%20WPF或這裏是一個'MaskedTextBox' http://msdn.microsoft.com/ EN-US /庫/ system.windows.forms.integration.windowsformshost.aspx。在你的情況下,這將是一個特殊的日曆控制?或者UserControl中的完整對話框? 'WindowsFormsHost'是空的。 –