zoukankan      html  css  js  c++  java
  • Telerik for silverlight RadAutoCompleteBox 动态数据源

    Telerik for silverlight RadAutoCompleteBox 和 silverlight Toolkit 的AutoCompleteBox 有点不一样,

    在后台设置数据源时不能使用 Populating 事件进行设置,而是使用 SearchTextChanged 事件进行数据源

    设置.

    如果需要设置过滤方式可以考虑 实现Telerik 的 IFilteringBehavior 接口

    Xaml:

    <telerik:RadAutoCompleteBox x:Name="testAuto" Width="170" Height="25" 
                                            AutoCompleteMode="Suggest"
                                            SearchTextChanged="testAuto_SearchTextChanged" 
                                            SelectionMode="Single">
    </telerik:RadAutoCompleteBox>

    Code:

    public partial class MainPage : UserControl
    {
            public MainPage()
            {
                InitializeComponent();
                //自定义过滤方式
                testAuto.FilteringBehavior = new CustomFilterBehavior();
            }
    
            private void testAuto_SearchTextChanged(object sender, EventArgs e)
            {
                const string test = "测试AutoCompleteBox";
                ObservableCollection<string> itemSouce = new ObservableCollection<string>();
                for (int i = 0; i < 20; i++)
                {
                    itemSouce.Add(string.Concat("test_", i, "_", test));
                }
                testAuto.ItemsSource = itemSouce;
            }
    }
  • 相关阅读:
    PCA与LDA
    SVM--交叉验证
    git的基本使用
    MySQL的操作
    MySQL安装和远程连接
    javaScript进阶
    javaScript基础入门篇
    javaScript运动
    可变对象和不可变对象
    基本数据类型
  • 原文地址:https://www.cnblogs.com/zhangbingCoder/p/3309580.html
Copyright © 2011-2022 走看看