How to use .NET Windows Control into the WPF Application
2013-06-17 22:56
555 查看
Host the Windows Form Control into WPF Application
It is easy to place the Windows Control into the WPF Window. There are very extensive ranges of controls available in Windows, which can be used in WPF application after reading the article.
Steps:
1. Create the WPF Application in visual studio 2008.
2. Make sure you have the reference of WindowsFormsIntegration.dll and System.Windows.Forms.dll.
3. Open the Window1.xaml in the designer.
4. Add the Windows Form namespace as follows
NOTE: If you want to any 3rd party control then add its reference to the project and add the namespace for the assembly.
5. Drag and drop the WindowsFormsHost control to Windows1.xaml Window.
6. Write the Xaml code inside the WindowsHost Element as followes
<my:WindowsFormsHost Name="windowsFormsHost1"
Height="62" VerticalAlignment="Top">
<wf:DateTimePicker Name="dtpicker1"></wf:DateTimePicker>
</my:WindowsFormsHost>
Compile and Run the WPF Application you would see the Windows Control there.
In the source code I user thee WindowsFormsHost, two contains the
DateTimePicker and third one contain empty DataGrid.
Summary: If you have already made investment in Windows Form control, you can use those in WPF without any issue.
转自【http://www.a2zdotnet.com/View.aspx?Id=80#.Ub8hYpyvy3I】
It is easy to place the Windows Control into the WPF Window. There are very extensive ranges of controls available in Windows, which can be used in WPF application after reading the article.
Steps:
1. Create the WPF Application in visual studio 2008.
2. Make sure you have the reference of WindowsFormsIntegration.dll and System.Windows.Forms.dll.
3. Open the Window1.xaml in the designer.
4. Add the Windows Form namespace as follows
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
NOTE: If you want to any 3rd party control then add its reference to the project and add the namespace for the assembly.
5. Drag and drop the WindowsFormsHost control to Windows1.xaml Window.
6. Write the Xaml code inside the WindowsHost Element as followes
<my:WindowsFormsHost Name="windowsFormsHost1"
Height="62" VerticalAlignment="Top">
<wf:DateTimePicker Name="dtpicker1"></wf:DateTimePicker>
</my:WindowsFormsHost>
Compile and Run the WPF Application you would see the Windows Control there.
In the source code I user thee WindowsFormsHost, two contains the
DateTimePicker and third one contain empty DataGrid.
Summary: If you have already made investment in Windows Form control, you can use those in WPF without any issue.
转自【http://www.a2zdotnet.com/View.aspx?Id=80#.Ub8hYpyvy3I】
相关文章推荐
- How to host WPF Control into the Windows Form Application
- how to use javascript to control the usercotrol in the asp.net
- How to Use the Visual Studio .NET Application Center Test
- [Windows Azure] How to use the Windows Azure Blob Storage Service in .NET
- 在线平互动台活动启动《Discover How to Make the Computer Easier to Use with Windows Vista》
- How to Use Lucene.NET with Windows Azure SQL Database
- How to set the width of columns?about chart control for .net
- How to use the Segmented Control
- How to use ValidationSummary control in asp.net
- How a .NET application determines what channel definition to use
- 如何使用spring将service层注入到servlet中去(how to use Spring to inject ur service layer into the servlet )
- How to set the QT Application icon in the windows.
- [转载]How to hide the OK button in the dialog in .Net Compact Framework application?
- Summarize the steps how to create a .NET application[摘自Beginning Visual C# 2008]
- How use the Ubutu to remote connect to Windows
- How To Use the Windows Phone 8.1 GridView and ListView Controls
- ASP.NET MVC Toolkit - how to use the Html Helper class
- How to Integrate Excel in a Windows Form Application using the WebBrowser
- use code to generate Silverlight Controls at run time, and serialize the control into XAML file
- How To Install and Use the Web Application Stress (WAS) Tool