I am adding a WINFORM chart to my WPF project using
System.Windows.Forms.Integration.WindowsFormsHost
I am trying to work around the "airspace" rendering issue where the host is always rendered as the top most element the window. The workaround I am using sets
IsRedireced = "true"
When I insert this into my XMAL code:
<Grid x:Name="ssCurveChartGrid" Grid.Column="1" Margin="110,30,160,306" Grid.ColumnSpan="4" RenderTransformOrigin="0.479,0.186">
<WindowsFormsHost IsRedirected =" "true">
</WindowsFormsHost>
</Grid>
or my code behind:
System.Windows.Forms.Integration.WindowsFormsHost host =
new System.Windows.Forms.Integration.WindowsFormsHost();
host.IsRedirected = "true";
I get the following error:
"The property 'IsRedirected' was not found in type 'WindowsFormsHost'
Here is a screenshot:
error http://i57.tinypic.com/2eal2k7.jpg
Can anyone help explain why this is happening? I relay need to display an element on top of my WINFORM chart!
Thanks
EDIT:
Code was taken from MSDN site: http://msdn.microsoft.com/en-us/library/ms752027.aspx
From MSDN: "By default, visible WindowsFormsHost elements are always drawn on top of other WPF elements, and they are unaffected by z-order. To enable z-ordering, set the IsRedirected property of the WindowsFormsHost to true and the CompositionMode property to Full or OutputOnly. To see the default z-order behavior"
" Copy the following XAML into the Grid element."
<!-- Z-order demonstration. -->
<Canvas Grid.Row="1" Grid.Column="1">
<WindowsFormsHost Canvas.Top="20" Canvas.Left="20" Background="Yellow">
<wf:Button Text="Windows Forms control" FlatStyle="Flat"/>
</WindowsFormsHost>
<Label Content="A WPF label" FontSize="24"/>
</Canvas>
Press F5 to build and run the application. The WindowsFormsHost element is painted over the label element.
"To see the z-order behavior when IsRedirected is true"
Replace the previous z-order example with the following XAML.
XAML
<!-- Z-order demonstration. -->
<Canvas Grid.Row="1" Grid.Column="1">
<WindowsFormsHost IsRedirected="True" CompositionMode="Full" Canvas.Top="20" Canvas.Left="20" Background="Yellow">
<wf:Button Text="Windows Forms control" FlatStyle="Flat"/>
</WindowsFormsHost>
<Label Content="A WPF label" FontSize="24"/>
</Canvas>
Press F5 to build and run the application. The label element is painted over the WindowsFormsHost element.