WPF GridSplitter可见性 [英] WPF GridSplitter visiblity
问题描述
我对GridSplitter的可见性有疑问.
I have a problem regarding GridSplitter visiblity.
在此,无论我托管的是Winform DataGridView.拖动时,GridSplitter在其他控件上正确可见.但是不在这个网格上.实际上,无论我托管什么而不是Datagridview,它都会成为最顶层的控件,这使GridSplitter隐藏在它的后面.
In this, whatever I am hosting a Winform DataGridView. The GridSplitter, when dragged is properly visible on other controls. But not on this grid. In fact, whatever I host instead of Datagridview, becomes the topmost control, which makes the GridSplitter hide behind it.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Name="rowForButton"/>
<RowDefinition Name="rowForGridSplitter" Height="Auto" MinHeight="81" />
</Grid.RowDefinitions>
<Button Grid.Row="0" Height="50" Width="110" Content="Button in First Row"/>
<my:WindowsFormsHost Panel.ZIndex="0" Grid.Row="1" Margin="30,11,138,0" x:Name="winHost" Height="58" VerticalAlignment="Top" OpacityMask="Transparent">
<win:DataGridView x:Name="dataGridView"></win:DataGridView>
</my:WindowsFormsHost>
<GridSplitter BorderThickness="1" Panel.ZIndex="1" Grid.Row="1" HorizontalAlignment="Stretch" Height="5" ShowsPreview="True" VerticalAlignment="Top">
</GridSplitter>
</Grid>
推荐答案
Windows窗体控件始终与WPF控件分开呈现,因此始终显示在WPF应用程序上.
Windows Forms controls are always rendered seperately from your WPF controls, and as a result will always appear over your WPF application.
请参见在WPF中托管Microsoft Win32窗口(小标题输出行为上的显着差异)以获取更多信息.
See Hosting a Microsoft Win32 Window in WPF (subheading Notable Differences in Output Behavior) for more info.
这篇关于WPF GridSplitter可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!