使用内容控件打破MVVM? [英] Is using a contentcontrol breaking MVVM?

查看:95
本文介绍了使用内容控件打破MVVM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是一个小问题,但我今天到目前为止还没有找到答案,所以我想我只是问问自己。



如果我放了一个contentcontrol在我的视图中,它的内容绑定到一个属性,然后在我的viewmodel中构建一个DataGridView并将该属性设置为破坏MVVM?



基本上我的应用程序需要在不同情况下有一个具有不同列的DataGrid。



我已阅读过关于在视图上放置DataGrid然后绑定到columncollection并使用行为等的内容。



我觉得使用内容控件真的会更容易但是必须有一个原因我找不到很多(或任何)有关天气打破MVVM的信息。



我尝试了什么:



Goole,CodeProject,StackOverflow

解决方案

由于它是只读,它只是一个小部件。



它下降与图像,标签,图表,LED属于同一类别。



将所有人(或多或少)视为持有人。



实际上,人们应该可以随时将网格换成图表或任何其他绩效指标,而不会出汗mvvm。

Just a small question but i haven't found an answer to it so far today so i thought i'd just ask myself.

If i place a contentcontrol in my view with it's contents bound to a property, then build a DataGridView in my viewmodel and set that property to it is that breaking MVVM?

Basically my application needs to have a DataGrid that has different columns in different circumstances.

I have read about placing a DataGrid on the view then binding to a columncollection and using behaivours and such.

I felt using a contentcontrol would just be easier really but there must be a reason i can't find many (or any) information on weather that breaks MVVM or not.

What I have tried:

Goole, CodeProject, StackOverflow

解决方案

Since it's "read-only", it's just a "widget".

It falls in the same category as an "image", "label", chart, "LED".

Treat them all (more or less) as place holders.

In fact, one should be able to swap your "grid" for a "chart" or any other "performance indicator", at any time, without sweating "mvvm".


这篇关于使用内容控件打破MVVM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆