2013-04-16 22 views
3

我需要爲我的項目創建可編輯的TreeListView。 但據我所知,WPF不提供任何類型的樹列表視圖,我在網上找到的那些沒有很多信息。我想用blend創建一些東西,然後將其應用於我的WPF項目。如何在WPF中創建可編輯的treelistview?

有沒有人有任何想法呢?

謝謝。

+0

編輯在以iniciate列表?那麼在Microsoft.com上呢? http://msdn.microsoft.com/en-us/library/vstudio/ms771523(v=vs.90).aspx –

+0

@NikhilAgrawal我已經看到了一段時間以前的鏈接,但它並沒有給予太多的幫助。我**需要**使用混合來定製它,但我無法使用此工具。你知不知道怎麼?謝謝。 – Ximbalimba

+1

**所有**都可在WPF中編輯。你只需要提供一個合適的'DataTemplate'。張貼你需要的截圖,我可以告訴你如何去做。 –

回答

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); 
    } 
} 
相關問題