按MSDN里的文章,能够实现其例子,即在Windows Presentation Foundation 中承载 Windows 窗体控件.可是在我的工程里, Windows 窗体控件不可见.只有位置轮廓.怎么解决啊?同样的代码,在我的工程里运行, Windows 窗体控件不可见.          System.Windows.Forms.Integration.WindowsFormsHost host =
                new System.Windows.Forms.Integration.WindowsFormsHost();            // Create the MaskedTextBox control.
            MaskedTextBox mtbDate = new MaskedTextBox("00/00/0000");            // Assign the MaskedTextBox control as the host control's child.
            host.Child = mtbDate;            // Add the interop host control to the Grid
            // control's collection of child controls.
            this.grid1.Children.Add(host);

解决方案 »

  1.   

    <Window
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     x:Class="testWPF.Window1"
     x:Name="Window"
     Title="Window1" 
        AllowsTransparency="True" 原因是我把主窗体的AllowsTransparency="True", 这样设置了,只要去掉这个设置, 窗体控件就能正常显示,可是我为了实现主窗口的特效, 必须保留这个设置, 这样该如何解决呢?
      

  2.   

    可能是呈现机制的问题 我试了下 暂时没找解决方法
    用这个方法替代下<Grid Margin="20" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Border BorderBrush="LightBlue" BorderThickness="1" SnapsToDevicePixels="True"/>
        <StackPanel Margin="5" Orientation="Horizontal" VerticalAlignment="Top">
            <TextBox Width="40" MaxLength="2" BorderThickness="0"/>
            <TextBlock Text="/" Padding="2,0"/>
            <TextBox Width="40" MaxLength="2" BorderThickness="0"/>
            <TextBlock Text="/" Padding="2,0"/>
            <TextBox Width="80" MaxLength="4" BorderThickness="0"/>
        </StackPanel>
    </Grid>