我想在頂部Winform控件上顯示WPF控件。 我希望WPF按鈕將出現在Winform文本框的頂部。頂部Winform控件無法看到WPF控件
結果是,WPF控件隱藏在winform文本框的後面,我看不到它。 這是爲什麼?
這是我的代碼:
<UserControl x:Class="Philips.PmsCT.Host.Applications.ExamApplication.ScanRulerComponent.WPFHostWF"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" Width="800" Height="120">
<Grid>
<WindowsFormsHost >
<wf:TextBox BackColor="LightBlue" />
</WindowsFormsHost>
<Button Width="100" Height="25" Background="Red"/>
</Grid>
此代碼顯示與您的問題不匹配的WPF控件內的Windows窗體。父窗口窗體在哪裏? – ChrisF 2012-03-06 13:00:42
@ChrisF我的猜測是,他想要在TextBox頂部的WPF按鈕。所以無論他對使用winforms的wpf還是一個簡單的佈局問題都有問題。 – dowhilefor 2012-03-06 13:05:22
嗨ChrisF,我會尖銳我的問題,我希望WPF按鈕將顯示在Winform文本框的頂部。 – EitanG 2012-03-06 13:11:19