文件夹树 [英] folder Tree

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

问题描述

我想使用控件创建文件夹树.我这样做:

I want to create folder tree with item Control. I do this:

 <StackPanel FlowDirection="RightToLeft" Orientation="Vertical">
                  <ItemsControl Name="b">
                    <ItemsControl.ItemsPanel>
                      <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical"/>
                      </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                      <DataTemplate>
                        <my:ucMyAccordion x:Name="myAccordion" />                        
                      </DataTemplate>
                    </ItemsControl.ItemTemplate>
                  </ItemsControl>
                </StackPanel>

myAccordion有文件夹的名称.

myAccordionhas the name of folder.

我有添加新文件夹的按钮,他的点击事件是:

I have button to add new folder, his click event do:

 ItemControl itemControl = new ItemControl(itemDoch.Count, strConName,null);
      
        itemDoch.Add(itemControl);

但是,计数增加了,我在屏幕上仅看到我添加的firs文件夹.我该怎么办?
 

but , the count is up and I see on screen only the firs folder I add. what am I need to do??
 

推荐答案

通常来说,对我们来说,建立一个与ItemsControl的ItemsSource属性数据绑定的集合更好利用ItemsControls的优势,或使用Items属性来编辑然后绑定的集合.

Generally speaking it is better for us to build up a collection which data-bound to ItemsControl's ItemsSource property in order to take advantage of ItemsControls, or use Items property to edit then bound collection.

请参阅此文档

http://msdn.microsoft.com/en-us/library /system.windows.controls.itemscontrol.aspx

任何其他问题,请随时让我知道.

Any further questions please feel free to let me know.


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

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