Referencing WPF form from VB

jwh

Well-known member
Joined
Aug 18, 2006
Messages
155
Programming Experience
3-5
[FONT=Geneva,Arial,Sans-serif]Morning all.

I have a problem with a WPF Form that I have added into an existing WinForms Application.

Here is the XAML for the form so far:

<Window x:Class="Window1"[/FONT]
[FONT=Geneva,Arial,Sans-serif] xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"[/FONT]
[FONT=Geneva,Arial,Sans-serif] xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"[/FONT]
[FONT=Geneva,Arial,Sans-serif] Title="Window1" Height="768" Loaded="Load" Width="1024">[/FONT]
[FONT=Geneva,Arial,Sans-serif] <Grid Name="MainGrid" >[/FONT]
[FONT=Geneva,Arial,Sans-serif] <Grid Margin="0,0,3,12.5" Height="200" Width="250" Name="Grid1" HorizontalAlignment="Right" VerticalAlignment="Bottom">[/FONT]
[FONT=Geneva,Arial,Sans-serif] <Grid.RowDefinitions>[/FONT]
[FONT=Geneva,Arial,Sans-serif] <RowDefinition Height="0.25*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] <RowDefinition Height="0.25*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] <RowDefinition Height="0.25*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] <RowDefinition Height="0.25*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] </Grid.RowDefinitions>[/FONT]
[FONT=Geneva,Arial,Sans-serif] <Grid.ColumnDefinitions>[/FONT]
[FONT=Geneva,Arial,Sans-serif] <ColumnDefinition Width="0.2*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] <ColumnDefinition Width="0.2*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] <ColumnDefinition Width="0.2*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] <ColumnDefinition Width="0.4*" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] </Grid.ColumnDefinitions>[/FONT]
[FONT=Geneva,Arial,Sans-serif] [/FONT]
[FONT=Geneva,Arial,Sans-serif] </Grid>[/FONT]
[FONT=Geneva,Arial,Sans-serif] <TextBox Margin="0,185,3,219" Name="TextBox1" HorizontalAlignment="Right" Width="250"></TextBox>[/FONT]
[FONT=Geneva,Arial,Sans-serif] <ListView Height="151" Margin="0,7,2,0" Name="ListView1" VerticalAlignment="Top" HorizontalAlignment="Right" Width="250" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] <TextBox Height="28" Margin="0,158,168,0" Name="TextBox2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="85"></TextBox>[/FONT]
[FONT=Geneva,Arial,Sans-serif] <TextBox HorizontalAlignment="Right" Margin="0,158,2,0" Name="TextBox3" Width="165" Height="28" VerticalAlignment="Top"></TextBox>[/FONT]
[FONT=Geneva,Arial,Sans-serif] <Canvas Visibility="Visible" Name="KeyCanvas" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" />[/FONT]
[FONT=Geneva,Arial,Sans-serif] </Grid>[/FONT]
[FONT=Geneva,Arial,Sans-serif]</Window>[/FONT]


As you can see, I have on there a Canvas called KeyCanvas, on which I intend to load buttons dynamically from my database.

This works fine in the March CTP of Visual Studio Orcas. (not within the winforms app, I might add - I developed this WPF form using the CTP, and have copied it into my winforms app)



However now that I am back in my winforms app in VS 2005, I can't reference any of the controls on the WPF form, eg KeyCanvas.

When I type Me. (and let intellisense appear) then there is no mention in the intellisense list of any of the controls.

If I manually type Me.KeyCanvas then I get the error "KeyCanvas is not a member of Window1"

How do I work around this?
 

Latest posts

Back
Top