tags:

views:

277

answers:

2

Hi,

I am working in a WPF application. And my problem is regarding the GridSplitter visiblity.

In my xaml code,I am maitaining a Grid. In the 3rd row of Grid, I am hosting a Winform DataGridView. In the same row, the GridSplitter is written.

When GridSplitter is dragged to adjust Grid Row sizes, for other controls like Buttons etc it is properly visible. But when it comes over the DataGridView which I am hosting, the GridSplitter hides behind the hosted control.

In fact, whatever I host instead of Datagridview,makes the GridSplitter hide behind it, when it is dragged.

I tried setting the ZIndex for GridSplitter. It did not make any difference.

Can anyone help me with this?

Following is my XAML sample code:-

<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>

Thanks.

A: 

Unfortuantely the WinForms control will always sit on top of your WPF elements, it does the same when you try and scroll it. The best way to work around it is to put the required logic for sizing/scrolling/whatever the WinForms part into a WinForms control, then host that control in the WPF form.

Steven Robbins
the Sizing logic i.e the GridSplitter control i have used, i can not put it into Win forms control, as the control which i want to host is a third party control.
A: 

Your Grid has only 2 rowdefinitions but needs 3. At the moment the WindowsFormsHost and the GridSplitter are sharing the second row (i.e. Grid.Row="1"). Presumably you want the WindowsFormsHost to use Grid.Row="2".

grantnz