WinForm - WPF 集成;一点一点

发布于 2024-08-24 12:31:26 字数 482 浏览 0 评论 0原文

我有一个在内部使用的中型 WinForm 应用程序(1 个窗体,托管 40 个用户控件)。我想迁移到 WPF,但无法进行批量重新发布。

目前,我的想法是在 WPF 中一次重新创建 App 1 用户控件,并将其托管在现有的 WinForm 应用程序中。此时,我会让它们看起来几乎相同,因此不需要进行大规模再培训。

我的问题更重要的是,是否有其他人尝试过这个以及数据部分如何工作。

我已将 WinForms 用户控件之一重新创建为 WPF 用户控件。我需要将其发布为用户控件库吗?

那么,我如何访问该 UC 的 DAL?我使用 Linq to Sql 数据层。


澄清一下,用户控件对我来说是一个“页面”,所以人口统计是一个用户控件。

另外,我的 DAL 是一个单独的库。我是否也希望在我的 WPF 解决方案中使用它,然后在那里设置数据绑定,当我将其导入 winform 应用程序时,它会随之而来,或者它只能在同一位置找到它...

I have a medium sized WinForm App (1 Form that hosts 40 user controls) that we use in house. I want to migrate over to WPF but I cannot do a Mass ReRelease.

My idea was, for now, to recreate the App 1 User Control at a time in WPF and have that hosted in the existing WinForm App. I would make them look nearly identical, at this point, so there would be no need for mass retraining.

My question is more to the point of, has any one else tried this and how does the data portion work.

I have recreated one of the WinForms User Controls as a WPF user Control. Do I need to publish that as a User Control Library?

How, then, would I access the DAL for that UC? I use a Linq to Sql data layer.


To clarify, user controls for me are a "Page", so Demographics is a user control.

Also, my DAL is a separate library. Would I want that in my WPF solution as well and then set up the data binding there and when I import it into the winform app it will come with it or it will just be able to find it at that same location...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

征棹 2024-08-31 12:31:26

我目前正在从 Win Form 版本迁移到 WPF 版本的程序。我使用的是非常标准的控件,因此不需要大量的用户控件编程。我发现这很容易。我的后端是来自 SQL2008 的一些 ORM 映射,并且很容易计算出来。

不过,WPF 确实有一些不同的数据绑定技术,因此您可能需要花一些时间查看 MSDn 来弄清楚 CollectionView 类等。

就您的用户控件而言,控件是否直接访问您的数据?或者他们是通过中间接口访问数据?

以前,我唯一的用户控件非常简单(屏蔽文本框、数字向上/向下等)。这些都托管在控件库中。对于您所讨论的内容,我认为导入您的 DAL 引用仍然有效。否则我不确定可能是什么问题。

科里

I am in the middle of a migration from a Win Form version to a WPF version of a program at the moment. I am using pretty standard controls, so there is not a whole lot of user control programming needed. I am finding it pretty easy. My back end is some ORM mapping from SQL2008, and it is pretty easy to work out.

WPF does have a bit of a different databinding technique, though, so you might have to spend some time looking at MSDn figuring out the CollectionView classes and whatnot.

as far as your user controls are concerned, are the controls accessing your Data driectly? Or are they instead accessing data through an intermediate interface?

Previously, my only user controls have been pretty simple (masked textbox, numeric up/down etc). These were all hosted in a control library. For what you are talking about, I would assume that importing your DAL reference, would still work. Otherwise I am unsure of what might be the problem.

Cory

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文