WPF 中的复杂视图

发布于 2024-08-02 02:47:57 字数 776 浏览 7 评论 0原文

我正在做一个个人项目。 我从上一篇文章开始(销售点应用程序架构)。

尝试使用-存储库-服务和View Modal-View方法

请参阅随附的图像文件。 我的大多数窗口都有多个视图。

我的问题是:

  1. 看着窗户,你认为 我的项目是一个很好的候选者 CAG (Prism) 还是太过分了
  2. 我能得到 POPUp 模式吗 窗口并与它们通信 来自其父视图区域模块。
  3. Prism 中的多个窗口(假设 我可以创建多个外壳), 他们之间有沟通吗 复杂
  4. 阅读关于创建复杂的SO 将子视图作为属性的视图。 这是一个好方法还是也会 代码越多

,我越多地研究应用某种模式,我就越感到困惑,

我确信你们中的一些人也遇到了类似的问题,并且您的方法可能会为我解决问题。

谢谢 三月

http://www.flickr.com/photos/themarworld/3820178039/ http:// www.flickr.com/photos/themarworld/3820178039/

I am working on a personal project. I started with a previous post (Point of Sale Application Architecture).

Trying to Use- repository - service and View Modal - View approach

Please see the attached image file. Most of my windows will have multiple views.

My Questions are:

  1. Looking at the windows do you think
    my project is a good candidate for
    CAG (Prism) or is it an overkill
  2. Will I be able to get POPUp modal
    windows and communicate to them
    from its parent view- region-module.
  3. Multiple Windows in Prism ( assuming
    that I can create multiple shell) ,
    Is communication between them
    complex
  4. read on SO about creating complex
    views with sub views as properties.
    Is this a good approach or will too
    much code

The more I look into applying some pattern more I am getting confused

I am sure there are some of you had similar issues and may be your approach might solve things for me.

Thank you
Mar

http://www.flickr.com/photos/themarworld/3820178039/ http://www.flickr.com/photos/themarworld/3820178039/

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

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

发布评论

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

评论(2

挽清梦 2024-08-09 02:47:57

我看不到你的屏幕截图,但我可以在这里给你一些指导。 我最近一直在设置一个多目标(WPF/Silverlight)复合应用程序的外壳,并一边学习这些库。

  1. “我的大多数窗口都有多个视图。” -- 这本身可能意味着您会喜欢在复合应用程序库中找到的内容。 MVVM 是 CAL 的完美模式。 在 StockTrader 参考应用程序中,他们使用术语“PresentationModel”,但这本质上与 MVVM 相同。

  2. 弹出模式在 WPF 和 SL 中都能很好地工作(通过工具包扩展 ChildWindow 控件)。 您可以像与常规区域一样与他们进行交流 - 通过注入视图和服务。 我发现特别巧妙的是,您可以在弹出窗口中定义一个区域,在加载应用程序(模块)时向其注册视图(即使该区域本身尚未加载),然后当该区域弹出时此时会注入正确的视图。 换句话说,您不必参与推迟视图的注入,直到显示该区域,而这是我所期望的。

  3. 尚未尝试过此操作 - 无法发表评论。

  4. 不确定“子视图”,但区域内的区域肯定是可能的。

I can't see your screenshot but I can give you a little direction here. I've been setting up the shell of a multi-targetted (WPF/Silverlight) composite app recently, learning the libraries as I go.

  1. "Most of my windows will have multiple views." -- this by itself probably means you'll like what you find in the Composite Application Library. And MVVM is a perfect pattern for the CAL. In the StockTrader reference application they use the term PresentationModel, but this is essentially the same thing as MVVM.

  2. Popup modals work great in both WPF and SL (via the Toolkit extension ChildWindow control). You'd communicate with them in same way you would a regular region - by injecting views and services. What I found particularly neat about this is that you can define a region in a popup, register views with it when the app (module) is loaded (even though the region itself is not yet loaded), and then when the region pops up the correct views are injected at that point. In other words you don't have to get involved in deferring the injection of the view until the region is displayed, which I was expecting to have to do.

  3. Haven't tried this -- can't comment.

  4. Not sure about "sub-views", but regions within regions is certainly possible.

微暖i 2024-08-09 02:47:57

韦恩对#1 和#2 有很好的答案...我会得到#3 和#4。

3)不共享相同视图模型的视图之间的通信是通过Prism中的EventAggregator完成的。 这是一个非常易于使用的消息发布者订阅者模型。 理解这一点你不会有任何困难。

4)我不喜欢将视图作为视图模型的属性的想法。 这是一个关注点分离的问题。 您正在努力让 ViewModel 与接口无关,这意味着太多的接口会泄漏到您的视图模型中。 2 种可接受的替代方案是

  • Sub ViewModels 作为您的属性
    视图模型。 你可以使用
    数据模板提供外观
    它们无需在中指定 UI
    视图模型。
  • 子区域。 这是完全可以接受的。 有时,根据您的 UI,它可能会变得棘手,因为您最终会尝试跟踪 RegionManager 范围,但这是可行的。

HTH,安德森

Wayne has good answers for #1 and #2... I'll get #3 and #4.

3) Communication between views that don't share the same view model is done through the EventAggregator in Prism. It's a very easy to use Publisher Subscriber model for messages. You'll have no trouble understanding this.

4) I don't like the idea of having a view as a property of a view model. It's a problem of separation of concerns. You're shooting for your ViewModels to be interface agnostic and this would imply too much interface leaking into your viewmodels. 2 acceptable alternatives would be

  • Sub ViewModels as properties of your
    ViewModel. You could use
    DataTemplates to provide the look to
    them without specifying the UI in the
    ViewModel.
  • Sub Regions. This is a perfectly acceptable. Sometimes it can get tricky depending on your UI because you'll end up trying to keep track of your RegionManager scopes, but it's doable.

HTH, Anderson

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