3

我需要TreeListView为我的项目创建一个可编辑的。但据我所知,WPF它没有提供任何类型的树列表视图,而且我在网上找到的那些信息也不是很丰富。我想使用创建一些东西blend,然后将其应用到我的WPF项目中。

有人对此有任何想法吗?

谢谢。

4

1 回答 1

0

我用过这样的东西,也许这会帮助你找到一个北方

<dxg:GridControl Name="GridName" Grid.Row="0">

<dxg:GridControl.Columns>

    <dxg:GridColumn FieldName="ID" Header="ID" 
                    AllowEditing="false" 
                    AllowMoving="False" AllowGrouping="False" AllowSorting="False"
                    >
    </dxg:GridColumn>

    <dxg:GridColumn Name="Name" FieldName="Name" Header="Name" AllowEditing="true"
                    AllowMoving="False" AllowGrouping="False" AllowSorting="False" >
    </dxg:GridColumn>

</dxg:GridControl.Columns>

<dxg:GridControl.View>
    <dxg:TreeListView Name="TreePeople" AutoWidth="True"
        KeyFieldName="Id" ParentFieldName="ParentId"
        TreeDerivationMode="Selfreference"
        MultiSelectMode="Row" EditorShowMode="MouseUpFocused" ShowingEditor="TreePeople_ShowingEditor" CellValueChanging="TreePeople_CellValueChanging" >
        <dxg:TreeListView.RowCellMenuCustomizations>
            <dxb:BarButtonItem BarItemName="btnAddRow"  />
            <dxb:BarButtonItem BarItemName="btnRemoveRow"  />
        </dxg:TreeListView.RowCellMenuCustomizations>
    </dxg:TreeListView>
</dxg:GridControl.View>

<i:Interaction.Behaviors>
    <dxg:TreeListDragDropManager AllowDrag="True" AllowDrop="True" AllowAutoExpand="True" Drop="TreeListDragDropManager_Drop" Dropped="TreeListDragDropManager_Dropped" />
</i:Interaction.Behaviors>

您需要先启动一个列表

public void constructor()
{
    try
    {
        IPeople cli = ProxyFactory.GetPeopleSvc();
        List<People> list = cli.GetClassification();

        if (list.count > 0)
        {
            ObservableCollection<People> tmp = new ObservableCollection<People>(list);
            GridName.ItemsSource = tmp;
        }
    }
    catch (Exception e)
    {
        Message.Show(e);
    }
}
于 2013-10-09T13:51:36.023 回答