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 - place net 2.0 control on xaml form

 
 
Old 02-15-2007   #1 (permalink)
Dirk Reske


 
 

place net 2.0 control on xaml form

Hello,

is it possible to place an "old" .Net 2.0 custom control on a wpf form?
How? They do not appear in the VS toolbox...

thanks!
Dirk



My System SpecsSystem Spec
Old 02-15-2007   #2 (permalink)
RobinS


 
 

Re: place net 2.0 control on xaml form

I don't think so. They are completely different types of controls.

Robin S.
-------------------
"Dirk Reske" <_Dirk.Reske@gmx.net> wrote in message
news:eHMG8UUUHHA.1200@TK2MSFTNGP04.phx.gbl...
> Hello,
>
> is it possible to place an "old" .Net 2.0 custom control on a wpf form?
> How? They do not appear in the VS toolbox...
>
> thanks!
> Dirk
>



My System SpecsSystem Spec
Old 02-16-2007   #3 (permalink)
Horst Klein


 
 

Re: place net 2.0 control on xaml form

Hi Dirk

Yes you can!
See the SDK Samples.
C:\Programme\Microsoft
SDKs\Windows\v6.0\Samples\WPFSamples\MigrationInterop\WpfHostingWindowsFormsControl


To design Windows use MS Expression Blend:
http://www.microsoft.com/products/ex...blend/try.mspx

"WPF and Windows Forms are 2 very different technologies although there is
some interoperability available through WindowsFormsHost. Cider will not be
supporting IComponent, only the Windows Forms designer will support that."

Thats the reason, why Blend don't show Controls inside the WindowsFormsHost
and why the designer in VS2005 is not realy handy.

Best regards
Horst





My System SpecsSystem Spec
Old 02-16-2007   #4 (permalink)
Dirk Reske


 
 

Re: place net 2.0 control on xaml form

Hello,

when I add

?<?Mapping XmlNamespace="wfi"
ClrNamespace="System.Windows.Forms.Integration"
Assembly="WindowsFormsIntegration"?>
<UserControl x:Class="VMessAX.MainForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="wfi"
xmlns:dh="dh" Height="273" Width="158">
<Grid>
<wfi:WindowsFormsHost>
</wfi:WindowsFormsHost>
</Grid>
</UserControl>

I get the messages that the tag WindowsFormsHost is not existing in
namespace wfi....

"Horst Klein" <horst.klein@vitodata.ch> schrieb im Newsbeitrag
news:%23Fn24pbUHHA.1364@TK2MSFTNGP06.phx.gbl...
> Hi Dirk
>
> Yes you can!
> See the SDK Samples.
> C:\Programme\Microsoft
> SDKs\Windows\v6.0\Samples\WPFSamples\MigrationInterop\WpfHostingWindowsFormsControl
>
>
> To design Windows use MS Expression Blend:
> http://www.microsoft.com/products/ex...blend/try.mspx
>
> "WPF and Windows Forms are 2 very different technologies although there is
> some interoperability available through WindowsFormsHost. Cider will not
> be
> supporting IComponent, only the Windows Forms designer will support that."
>
> Thats the reason, why Blend don't show Controls inside the
> WindowsFormsHost
> and why the designer in VS2005 is not realy handy.
>
> Best regards
> Horst
>
>
>
>
>



My System SpecsSystem Spec
Old 02-16-2007   #5 (permalink)
Horst Klein


 
 

Re: place net 2.0 control on xaml form

Hi Dirk

Try this:
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WinForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
Title="MyWindowsFormHostSample" Height="300" Width="300">
<Grid>
<Button Name="Button1" Height="50" Margin="0,0,0,20" Content="WPF
Button"/>
<wfi:WindowsFormsHost Name="WinFormsHost" Height="50" Margin="0,100,0,0"
Background="Yellow">
<WinForms:Button Name="MyWinFormButton" Text="Forms Button"
Height="50"/>
</wfi:WindowsFormsHost>
</Grid>
</Window>

Best regards
Horst


My System SpecsSystem Spec
Old 02-17-2007   #6 (permalink)
Laurent Bugnion [MVP]


 
 

Re: place net 2.0 control on xaml form

Hi,

RobinS wrote:
> I don't think so. They are completely different types of controls.


Only as different as, for example, an ActiveX control is from an HTML
placeholder :-) Integration is the key, and WindowsFormsHost is the
answer...

>
> Robin S.
> -------------------
> "Dirk Reske" <_Dirk.Reske@gmx.net> wrote in message
> news:eHMG8UUUHHA.1200@TK2MSFTNGP04.phx.gbl...
>> Hello,
>>
>> is it possible to place an "old" .Net 2.0 custom control on a wpf form?
>> How? They do not appear in the VS toolbox...
>>
>> thanks!
>> Dirk


Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
User Control -> disappear when form.Click .NET General


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