WPF:具有内联编辑功能的自定义Treeview项 [英] WPF: Custom Treeview items with inline editing

查看:86
本文介绍了WPF:具有内联编辑功能的自定义Treeview项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有以下课程

public class Galaxy
    {
        public string Name { get; set; }
        public GalaxyType Type { get; set; }
        public ObservableCollection<CGroup> SubGalaxies 
        { get; set; }

        public Galaxy()
        {
            SubGalaxies = new ObservableCollection<Galaxy>();
        }
    }

enum GalaxyType:int
{
None=0,
Spiral,
Oval,
Unknown
}

我需要为上述层次结构创建一个Treeview,并允许对每个Galaxy/SubGalaxies进行就地编辑.

I need to create a Treeview for the above hierarchy and allow inplace editing of each Galaxy/SubGalaxies.

当用户向银河中添加子星系时,我需要在后面更新XML.

As and when user adds sub galaxies to the Galaxy, I need to update an XML behind.

瑞诗ail.

推荐答案

只需使用HierarchicalDataTemplate并设置两种方式的绑定...实际上,您想要做的实际上是TreeView的一个非常简单的实现.也许从本教程开始:

Just use a HierarchicalDataTemplate and setup two way binding...what you're trying to do is actually a pretty straight forward implementation of a TreeView.  Perhaps start with this tutorial:

http://blogs.microsoft.co .il/blogs/davids/archive/2009/06/04/hierarchicaldatatemplate-and-treeview.aspx

希望有帮助,

Aj


这篇关于WPF:具有内联编辑功能的自定义Treeview项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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