WPF调用Winfrom控件

1.添加2个相关dll引用WindowsFormsIntegration.dll (负责整合WPF和Windows)、System.Windows.Forms.

WPF调用Winfrom控件_第1张图片

2.在 XAML文件中添加两个引用

xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"

3.在XAML编码区实现你想添加的控件

WPF调用Winfrom控件_第2张图片

添加的是WINFORM中的DateTimePicker控件


CustomFormat="yyyy-MM-dd HH:mm:ss "
Format="Custom">

4.运行界面

WPF调用Winfrom控件_第3张图片



转载于:https://www.cnblogs.com/h20064528/archive/2012/02/13/2348730.html

你可能感兴趣的:(WPF调用Winfrom控件)