动态数据矩阵WPF [英] Dynamic data matrix WPF

查看:724
本文介绍了动态数据矩阵WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个完全动态的数据矩阵。对于如

I want to create a completely dynamic data matrix. For eg,

       Column1 Column2 Column3....
id1      id11    id12     id13...
id2      id21    id22     id23...
.         .        .        .
.         .        .        .



任何人可以帮助我在XAML代码将在上述方式显示数据?我的意思是,我不知道我是否应该使用列表视图或数据网格或其他任何显示data.So如果任何人可以使用一些示例代码和帮助我吧..

Can anybody help me with the code in XAML that will display the data in the above manner? I mean I am not sure if I should be using listview or datagrid or anything else to display the data.So if anybody could use some example code and help me out with it..

推荐答案

您很可能使用我的回答的这个问题。它是用来显示,编辑和数据绑定一维或二维数组,动态大小列出了子类的DataGrid。它可以从 rel=\"nofollow\">下载。

You could probably use my answer to this Question. It's a subclassed DataGrid used to display, edit and databind 1D or 2D arrays and lists of dynamic size. It can be downloaded from here.

假设你有一个字符串这个二维数组作为一个属性

Say you have this 2D array of strings as a Property

public string[][] String2DArray { get; set; }



然后就可以通过向DataGrid2DLibrary.dll引用其绑定到DataGrid2D并添加命名空间

then you can bind it to the DataGrid2D by adding a reference to the DataGrid2DLibrary.dll and add the namespace

xmlns:dg2d="clr-namespace:DataGrid2DLibrary;assembly=DataGrid2DLibrary"

<dg2d:DataGrid2D Name="c_dataGrid2D" 
                 UseModifiedDataGridStyle="True" 
                 ItemsSource2D="{Binding String2DArray}"/>

和输出将看起来像这样

这篇关于动态数据矩阵WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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