【问题标题】:Silverlight toolkit. Treeview drag and drop functionalitySilverlight 工具包。树视图拖放功能
【发布时间】:2010-07-19 11:42:46
【问题描述】:

拖放不适用于此快照:

   <toolkitDrag:TreeViewDragDropTarget AllowDrop="true" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" BindingValidationError="TreeViewDragDropTarget_BindingValidationError" ItemDroppedOnSource="TreeViewDragDropTarget_ItemDroppedOnSource" ItemDroppedOnTarget="TreeViewDragDropTarget_ItemDroppedOnTarget" ItemDragStarting="TreeViewDragDropTarget_ItemDragStarting">

       <controls:TreeView Name="treeView">

           <controls:TreeView.ItemTemplate>

               <toolkit:HierarchicalDataTemplate ItemsSource="{Binding Children}">

                  <StackPanel Orientation="Horizontal">

                       <TextBlock Text="{Binding Path=FullDescription}" />

                   </StackPanel>

               </toolkit:HierarchicalDataTemplate>

           </controls:TreeView.ItemTemplate>

       </controls:TreeView>

   </toolkitDrag:TreeViewDragDropTarget>

公共组织树()

   {

       InitializeComponent();



       var organizationNodes=new List<OrganizationNode>();

       var firstNode = new OrganizationNode() { FullDescription = "Description" };

       firstNode.Children.Add(new OrganizationNode() { FullDescription = "desc1" });

       firstNode.Children.Add(new OrganizationNode() { FullDescription = "desc2" });

       firstNode.Children.Add(new OrganizationNode() { FullDescription = "desc3" });

       firstNode.Children.Add(new OrganizationNode() { FullDescription = "desc4" });

       organizationNodes.Add(firstNode);

       this.treeView.ItemsSource = organizationNodes;

   }

假设开箱即用。有什么想法有什么问题吗?

【问题讨论】:

    标签: c# .net wpf silverlight


    【解决方案1】:

    我已将列表更改为 ObservableCollection,现在拖放工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 2020-01-12
      • 1970-01-01
      • 2010-11-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多