Hello,
I am facing a tough issue when using WPF user control along with WinForms.
I am using Visual Studio 2008 SP1 on a PC with WindowsXP 2002 SP2.
Here's the problem.
1. Create a Win Forms Application with a single form (Form1).
2. Add a WPF user control named UserControl1 to the project. Code for UserControl1as show below
<
UserControl x:Class="WindowsFormsApplication1.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="Auto" Width="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBox Grid.Column="0" Grid.Row="0" Text="User Control 1"/>
</Grid>
</
UserControl>
3. Add another WPF user control named UserControl2 as show below
<
UserControl x:Class="WindowsFormsApplication1.UserControl2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:WindowsFormsApplication1"
Height="Auto" Width="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox Grid.Column="0" Grid.Row="0" Text="User Control 2"/>
<my:UserControl1 Grid.Column="0" Grid.Row="1"></my:UserControl1>
</Grid>
</
UserControl>
4. Now add UserControl2 to Form1.
5. Rebuild All. and try to open Form1 inthe designer again. the following errorappears.
|
|
|
| Instances of this error (1) |
|
|
|
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at WindowsFormsApplication1.UserControl1.InitializeComponent() in e:\Musthafa\VisualStudioTest\WindowsFormsApplication1\UserControl1.xaml:line 1 at WindowsFormsApplication1.UserControl1..ctor() in E:\Musthafa\VisualStudioTest\WindowsFormsApplication1\UserControl1.xaml.cs:line 24 |
|
| Forum posts about this error |
|
| Search the MSDN Forums for posts related to this error |
|
|
|
|
|
|
|
|
Hard Core Soft Ware