Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WinFormsHost DataGridView rendering problems in WPF .NET 4.0

$
0
0

Hello,

I have a windows forms datagrid hosted in a WPF application using the windows form host.  I originally wrote my application using .NET 3.5/VS2008 and everything worked very well.  When I upgraded my application to .NET 4.0/VS2010 all of the sudden the application will intermittently not render correctly, in that the UI looks like it is hung and displays what was behind the application when it was started.

Here is the XAML, which is nothing fancy.

<Window x:Class="SubsystemsTestHarness.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    Title="Subsystems Test Harness" Height="565" Width="883" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"><Grid Height="502"><TabControl Margin="12" Name="tabControl1"><TabItem Header="Client" Name="tabItem2" Visibility="Visible"><Grid><ListBox Margin="6,40,6,205" Name="methodLBox" SelectionChanged="listBox2_SelectionChanged" /><Label Height="28" HorizontalAlignment="Left" Margin="6,6,0,0" Name="label1" VerticalAlignment="Top" Width="120">Messages:</Label><my:WindowsFormsHost Margin="6,0,6,40" Name="windowsFormsHost1" Height="158.687" VerticalAlignment="Bottom"><wf:DataGridView x:Name="myDG" Dock="Fill" AllowUserToAddRows="False" AllowUserToDeleteRows="False" 
                                         AllowUserToOrderColumns="False" AutoSizeColumnsMode="AllCells" /></my:WindowsFormsHost><Button Height="28" HorizontalAlignment="Right" Margin="0,0,6,6" Name="sendBtn" VerticalAlignment="Bottom" Width="83" Click="button1_Click" IsEnabled="False">Send</Button><Button Height="28" HorizontalAlignment="Right" Margin="0,0,184,6" Name="createBtn" VerticalAlignment="Bottom" Width="83" Click="createBtn_Click">Start</Button><Button Height="28" HorizontalAlignment="Right" Margin="0,0,95,6" Name="destroyBtn" VerticalAlignment="Bottom" Width="83" Click="destroyBtn_Click" IsEnabled="False">Stop</Button><ComboBox Height="28" Margin="6,0,273,6" Name="interfaceCBox" VerticalAlignment="Bottom" SelectionChanged="interfaceCBox_SelectionChanged" /></Grid></TabItem></TabControl></Grid></Window>

Is there a known issue in .NET 4.0 when using the windows forms data grid?  I would hate to have to re-write my code just to deal with this issue.

Thanks!


Viewing all articles
Browse latest Browse all 18858

Trending Articles