【问题标题】:Treeview Instead of listbox in AutoCompleteBox Silverlight树视图而不是 AutoCompleteBox Silverlight 中的列表框
【发布时间】:2014-06-17 14:35:03
【问题描述】:

我需要一个 AutoCompleteBox,它会根据他们的父母在 TreeView 中显示结果。 此操作不需要是动态的。唯一的要求是,用户应该能够看到 AutoCompleteBox 弹出结果与他们的父母像一棵树。

有没有办法实现这种组件或任何现成的组件?

【问题讨论】:

  • 有可能!但是到目前为止您尝试了什么?
  • 我没有找到有关此主题的任何信息。我​​需要有关此的示例或说明。

标签: c# silverlight autocomplete treeview


【解决方案1】:

在 AutoCompleteBox 中有一个 Treeview,

<sdk:AutoCompleteBox IsTextCompletionEnabled="True" AllowDrop="True"   ItemsSource="{Binding}"   x:Name="txtMain"  Height="25">
                <sdk:AutoCompleteBox.ItemTemplate> 
                    <DataTemplate>
                        <sdk:TreeView   ItemsSource="{Binding YourCollection}" Name="treeView1">
                            <sdk:TreeView.ItemTemplate>
                                <sdk:HierarchicalDataTemplate ItemsSource="{Binding YourCollection}">
                                    <TextBlock Text="{Binding Property}" />
                                    </sdk:HierarchicalDataTemplate>
                            </sdk:TreeView.ItemTemplate>
                        </sdk:TreeView>
                    </DataTemplate>
                </sdk:AutoCompleteBox.ItemTemplate>
            </sdk:AutoCompleteBox>

【讨论】:

猜你喜欢
  • 2023-03-21
  • 2023-03-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-06
  • 2017-05-23
  • 1970-01-01
相关资源
最近更新 更多