Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - WPF UserControl in a Forms.UserControl

 
 
Old 01-10-2006   #1 (permalink)
MichaelG


 
 

WPF UserControl in a Forms.UserControl

I've managed to add a WPF button to a Forms.UserControl in code and am now
trying to add a WPF UserControl (defined in XAML) onto a Forms.UserControl.

I've started with Add->New Item...->WinFX User Control which adds
TestPage.xaml and TestPage.xaml.cs to the project. I've added some XAML
inside <UserControl.FixedTemplate> (works in XAMLPad) but when I compile I
get 'Error 2 The name 'InitializeComponent' does not exist in the current
context'. I've looked at one of the SDK samples and it seems TestPage.g.cs
should be generated but isn't.

What have I missed? Is it ok to mix WPF and Forms classes in the same DLL
or do I need to put all WPF Controls into a separate assembly?

Thanks
Michael



My System SpecsSystem Spec
Old 01-10-2006   #2 (permalink)
Nick Kramer [MSFT]


 
 

Re: WPF UserControl in a Forms.UserControl

Have you told VS how to compile .xaml files? You do that by adding a line
to your project file, described on
http://blogs.msdn.com/mhendersblog/a...03/476536.aspx (look for
"Whatchoo talkin' 'bout Willis?")

-Nick Kramer [MSFT]
http://blogs.msdn.com/nickkramer

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"MichaelG" <MichaelG@newsgroups.nospam> wrote in message
news:uLVT5jBAGHA.272@TK2MSFTNGP09.phx.gbl...
> I've managed to add a WPF button to a Forms.UserControl in code and am now
> trying to add a WPF UserControl (defined in XAML) onto a
> Forms.UserControl.
>
> I've started with Add->New Item...->WinFX User Control which adds
> TestPage.xaml and TestPage.xaml.cs to the project. I've added some XAML
> inside <UserControl.FixedTemplate> (works in XAMLPad) but when I compile I
> get 'Error 2 The name 'InitializeComponent' does not exist in the current
> context'. I've looked at one of the SDK samples and it seems
> TestPage.g.cs should be generated but isn't.
>
> What have I missed? Is it ok to mix WPF and Forms classes in the same DLL
> or do I need to put all WPF Controls into a separate assembly?
>
> Thanks
> Michael
>
>



My System SpecsSystem Spec
Old 01-10-2006   #3 (permalink)
MichaelG


 
 

Re: WPF UserControl in a Forms.UserControl

That was it. Thanks.


"Nick Kramer [MSFT]" <nkramer@ms.spam> wrote in message
news:OmsmaaDAGHA.3140@TK2MSFTNGP14.phx.gbl...
> Have you told VS how to compile .xaml files? You do that by adding a line
> to your project file, described on
> http://blogs.msdn.com/mhendersblog/a...03/476536.aspx (look
> for "Whatchoo talkin' 'bout Willis?")
>
> -Nick Kramer [MSFT]
> http://blogs.msdn.com/nickkramer
>
> ---
> This posting is provided "AS IS" with no warranties, and confers no
> rights. Use of included script samples are subject to the terms specified
> at http://www.microsoft.com/info/cpyright.htm
>
>
> "MichaelG" <MichaelG@newsgroups.nospam> wrote in message
> news:uLVT5jBAGHA.272@TK2MSFTNGP09.phx.gbl...
>> I've managed to add a WPF button to a Forms.UserControl in code and am
>> now trying to add a WPF UserControl (defined in XAML) onto a
>> Forms.UserControl.
>>
>> I've started with Add->New Item...->WinFX User Control which adds
>> TestPage.xaml and TestPage.xaml.cs to the project. I've added some XAML
>> inside <UserControl.FixedTemplate> (works in XAMLPad) but when I compile
>> I get 'Error 2 The name 'InitializeComponent' does not exist in the
>> current context'. I've looked at one of the SDK samples and it seems
>> TestPage.g.cs should be generated but isn't.
>>
>> What have I missed? Is it ok to mix WPF and Forms classes in the same
>> DLL or do I need to put all WPF Controls into a separate assembly?
>>
>> Thanks
>> Michael
>>
>>

>
>



My System SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46