本文介绍了DevExpress树列表控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在treelist控件中显示xml数据。我有一个根节点,一个子节点,另外还有四个子节点。

I need to display the xml data in the treelist control. I have one root node, one Child node and further four children for this child node.

我无法将它显示在treelist中。我正在使用 dataset.readXml 方法来读取xml文件并将数据集作为数据源。以下是我正在关注的代码:

I am not able to display it in the treelist. I am using the dataset.readXml method for reading the xml file and giving dataset as a datasource. Here is the code I am following:

DataSet dataSet = new DataSet();
dataSet.ReadXml(@"C:\foldersettings.xml");
treeList2.DataSource = dataSet;
treeList2.PopulateColumns();
treeList2.BestFitColumns();
treeList2.ExpandAll();

任何人都可以告诉我为什么我没有收到数据。我正在使用DevExpress 9.1版本控制。

Can anyone tell me why am I not getting the data in treelist. I am using DevExpress 9.1 version control.

推荐答案

DataSet dataSet = new DataSet();
dataSet.ReadXml(@"C:\foldersettings.xml");
treeList2.DataSource = dataSet.Table[0];
treeList2.PopulateColumns();
treeList2.BestFitColumns();
treeList2.ExpandAll(); 

这篇关于DevExpress树列表控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 21:47