Datagrid行的静态数据可以纯粹在XAML中定义,也就是说没有代码? [英] Can static data for Datagrid rows be defined purely in XAML i.e. no code behind?

查看:163
本文介绍了Datagrid行的静态数据可以纯粹在XAML中定义,也就是说没有代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有静态数据,我想以Datagrid格式显示。这些值仅供显示,不会更改。可以将其添加为Datagrid控件的某种子标签,以便我可以避免代码中的任何内容吗?



只有Datagrid控件的目的才是实验使用和演示某些Datagrid UI功能与虚拟blah blah内容。



如果纯XAML内容是不可能的,那么什么是最好的(快速和脏)的方法来设置数据网格的虚拟内容?可以不编写类等吗?

解决方案

检查这个 MSDN页面



由于datagrid使用类似于Combobox或ListBox的ItemsControl,datagrid应该是相同的逻辑。在这个例子中,他们基本上创建了纯XAML中的整个对象集合。


I have static data that I want to display in Datagrid format. The values are for display purposes only and will not change. Can it be added as some kind of subtag of the Datagrid control so I can avoid anything in the codebehind?

It has to be Datagrid control only as the purpose is to experiment with and demo certain Datagrid UI features with dummy blah blah content.

If pure XAML content is not possible then what is the best (quick & dirty) method to set up dummy content for a datagrid? Can it be done without writing classes etc?

解决方案

Check the example section on this MSDN page

Since the datagrid uses ItemsControl similar to Combobox or ListBox, datagrid should be the same logic. In that example they basically create a whole collection of objects in pure XAML.

这篇关于Datagrid行的静态数据可以纯粹在XAML中定义,也就是说没有代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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