Win Form用户控件在WPF xaml中不可见
我有一个xaml启动表单,我试图在其中托管一个windows表单控件,它是一个显示产品名称/许可证内容的启动屏幕。。下面是我用来承载用户控件的xaml代码,但它根本不可见。不是在设计器中,也不是在我实际运行应用程序时。。。这有什么不对Win Form用户控件在WPF xaml中不可见,wpf,winforms,xaml,Wpf,Winforms,Xaml,我有一个xaml启动表单,我试图在其中托管一个windows表单控件,它是一个显示产品名称/许可证内容的启动屏幕。。下面是我用来承载用户控件的xaml代码,但它根本不可见。不是在设计器中,也不是在我实际运行应用程序时。。。这有什么不对 <Window x:Class="StartupWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sch
<Window
x:Class="StartupWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wf="clr-namespace:namespace;assembly=assemblyName"
mc:Ignorable="d" x:Name="splashWindow"
WindowStyle="None" ResizeMode="NoResize" Width="500" Height="400"
AllowsTransparency="True" Background="Transparent" ShowInTaskbar="False" Topmost="True"
>
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Unloaded">
<BeginStoryboard>
<Storyboard x:Name="board">
<DoubleAnimation Storyboard.TargetName="splashWindow" Storyboard.TargetProperty="Opacity" From="1.0" To="0" Duration="0:0:1.5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Grid x:Name="LayoutRoot">
<Grid x:Name="Splash" Width="450" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,100,0,0">
<Grid x:Name="Back">
<Grid.Effect>
<DropShadowEffect ShadowDepth="1" Direction="-90" BlurRadius="10" Opacity="0.25"/>
</Grid.Effect>
<Border Background="Black" CornerRadius="3" Opacity="0.15"/>
<Border CornerRadius="2" Margin="1" Background="#229C47"/>
</Grid>
<Grid x:Name="Content_Area" Margin="12">
<Image x:Name="Image" Stretch="None" Height="99" Grid.Row="1"/>
<TextBlock x:Name="Info" TextWrapping="Wrap" Text="Starting..." Grid.Row="2" Margin="12,12,12,0" Foreground="White"/>
</Grid>
</Grid>
<WindowsFormsHost Height="325" Name="splashControl" Margin="54,12,64,24" Width="460" HorizontalAlignment="Center" Background="Transparent">
<wf:SplashControl />
</WindowsFormsHost>
</Grid>
</Window>
我现在正与同样的问题作斗争 这里的问题是窗口的
allowTransparency=“True”
,这与使用WindowsFormsHost
显示WinForms控件不兼容
看看。首先让我印象深刻的是,
wf
名称空间似乎不太可能指向您想要的内容。我不知道SplashControl
是在哪里创建的,但可能不在名为namespace
的程序集中名为namespace
的命名空间中。当我指向该程序集并将该程序集作为引用添加时,它确实会显示正确的命名空间。。启动与splash控件位于不同的程序集中。这就是为什么我担心wf
似乎没有指向任何地方:您的标记需要知道从哪里获取splash控件
信息。程序集引用必须是正确的,但如果它不在标记中,则这些引用基本上被忽略。它位于正确的程序集和命名空间中。。。它没有给出任何错误。。你看到其他问题了吗?有人能帮忙吗?