Devexpress XtraTreelist如何为treelist节点添加特定图标 [英] Devexpress XtraTreelist How to put specific icon for treelist node

查看:146
本文介绍了Devexpress XtraTreelist如何为treelist节点添加特定图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为父节点sub_child node..etc应用特定图像。例如,我想为国家,国家,名称,州,州和XML结构分配不同的图像。

我在图像目录中加载了5个不同的图像。我需要一些示例来为我的树视图添加不同的图像。





How can i apply a specific image for Parent node, sub_child node..etc. For example, I want to assign a different image for countries, country, name, states, state with respect to the XML structure.
I have loaded 5 different images in the image directory. I need some example to add different images to my treeview.


<pre lang="xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;countries&gt;
    &lt;country&gt;
        &lt;name&gt;India&lt;/name&gt;
        &lt;states&gt;
            &lt;state&gt;TamilNadu&lt;/state&gt;
            &lt;state&gt;Andhra&lt;/state&gt;
            &lt;state&gt;Kerala&lt;/state&gt;
            &lt;state&gt;Karnataka&lt;/state&gt;
        &lt;/states&gt;
    &lt;/country&gt;
&lt;/countries&gt;</pre>

推荐答案

1。创建包含所有5个图像的ImageList。

2.将正确的图像索引添加到XML /数据源。

3.使用ImageIndexFieldName属性指定数据源中的哪个字段包含每个节点的imageindex。



参见https://documentation.devexpress.com/#windowsforms/DevExpressXtraTreeListTreeList_ImageIndexFieldNametopic [ ^ ]有关ImageIndexFieldName属性的更多信息。
1. Create an ImageList containing all 5 images.
2. Add the correct image indexes to your XML/datasource.
3. Use the ImageIndexFieldName property to specify which field in your datasource contains the imageindex for each node.

See https://documentation.devexpress.com/#windowsforms/DevExpressXtraTreeListTreeList_ImageIndexFieldNametopic[^] for more information on the ImageIndexFieldName property.


这篇关于Devexpress XtraTreelist如何为treelist节点添加特定图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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