Datagrid行的静态数据可以纯粹在XAML中定义,也就是说没有代码? [英] Can static data for Datagrid rows be defined purely in XAML i.e. no code behind?
问题描述
只有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屋!