推荐的 WPF 应用程序项目结构是什么?
您好,我对 WPF 还很陌生。我喜欢 MVVM(模型-视图-视图模型)模式。我当前的项目具有以下类型的文件/命名空间结构:
Clients
Controls
ClientNameControl.xaml
ClientSurnameControl.xaml
Views
ClientCapture.xaml
Models
Client.cs
ViewModels
ClientViewModel.cs
等等。每个领域对象(例如客户、产品等)都具有上述结构。控件用于组成视图,非常通用的控件被分成单独的控件项目并在项目中引用。我的问题是这是否是一个有用的结构? MVVM 的所有示例似乎都采用以下方法来处理文件/命名空间层次结构:
ViewModels
ClientViewModel.cs
ProductViewModel.cs
Models
Clients.cs
Products.cs
Views
CliewntView
ProductView
任何评论将不胜感激。提前致谢:)
更新:我一直在四处寻找,下面的链接提供了有用的信息。我将以更传统的方式构建我的项目。
Hi I am quite new to WPF. I like the MVVM (Model-View-ViewModel) pattern. My current project has the following type of file/namespace structure:
Clients
Controls
ClientNameControl.xaml
ClientSurnameControl.xaml
Views
ClientCapture.xaml
Models
Client.cs
ViewModels
ClientViewModel.cs
And so forth. With each domain object like clients, products etc. each having the structure above. Controls are used to compose views, very generic controls are split out into separate control projects and referenced in the project. My question is if this is a useful structure? All the examples of MVVM seem to take the following approach to file/namespace hierarchy:
ViewModels
ClientViewModel.cs
ProductViewModel.cs
Models
Clients.cs
Products.cs
Views
CliewntView
ProductView
Any comments would be appreciated. Thanks in advance :)
UPDATE: I have been looking around and the below links provided useful information. I am going to structure my project the more traditional way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们为视图和视图模型创建了不同的项目。在大型项目中,它使维护变得更容易。我们的目录是 -
另请参阅此问题以获取更多信息。与 WPF 项目结构相关 -
推荐的 WPF 项目结构?
We have created different projects for View and View models. It makes things easier to maintain in case of huge projects. Directories we had were -
Also have a look at this SO question for some more info. related to WPF project structures -
Recommended WPF Project Structure?