且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在WPF中的其他控件下进行windowsformshost布局

更新时间:2023-10-19 16:54:04

放置 WindowsFormHost :

 <   StackPanel     Panel.ZIndex   =  2   名称跨度>  =  pnlLeftMenu   方向  = 水平   高度  =  400     Horizo​​ntalAlignment   =    保证金  =   -  150,0,0,0 >  
< 边框 BorderBrush
= #AF1719 BorderThickness = 1 宽度 = 150 背景 = #4C808080 >
<! - 您的WindowsFormHost就在这里...... - >
< / Border >
< Grid >
< 按钮 名称 = btnLeftMenuHide 宽度 = 48 高度 = 48 点击 = btnLeftMenuHide_Click 内容 = 隐藏 可见性 = 隐藏 / >
< 按钮 名称 = btnLeftMenuShow 宽度 = 48 高度 = 48 单击 = btnLeftMenuShow_Click 内容 = 显示 / >
< / Grid >
< / StackPanel >


I have a application like following article : Sliding Panel in WPF - Code Scratcher[^] .In main I create a in center position .when left panel is expanded ,panel left is under WindowsFormsHost.How to set WindowsFormsHost to over other lay out

What I have tried:

Please tell me any solution for my problem

Place your WindowsFormHost inside the Border control:
<StackPanel Panel.ZIndex="2" Name="pnlLeftMenu" Orientation="Horizontal" Height="400" HorizontalAlignment="Left" Margin="-150,0,0,0">
	<Border BorderBrush="#AF1719" BorderThickness="1" Width="150" Background="#4C808080" >
	    <!-- Your WindowsFormHost goes here... -->
	</Border>
	<Grid>
		<Button Name="btnLeftMenuHide" Width="48" Height="48" Click="btnLeftMenuHide_Click" Content="Hide" Visibility="Hidden"/>
		<Button Name="btnLeftMenuShow" Width="48" Height="48" Click="btnLeftMenuShow_Click" Content="Show"/>
	</Grid>
</StackPanel>