RadAutoComplete-Xamarin Forms中不会触发聚焦和非聚焦事件

时间:2018-06-26 05:44:33

标签: c# xamarin xamarin.forms autocomplete telerik

RadAutoComplete中不会触发焦点和未焦点事件。我已经尝试过PropertyChanged事件,并且工作正常。但是一旦用户进入并离开该字段,我需要保存数据。

您能说说如何处理重点和非重点事件吗?或当用户离开该字段时,是否还有其他事件可获取用户输入。

这是我的示例代码

    public AutoCompleteGettingStartedCSharp()
    {
        // >> autocomplete-getting-started-csharp
        var autoComplete = new RadAutoComplete { Watermark = "Search here..." };
        // << autocomplete-getting-started-csharp

        autoComplete.ItemsSource = new List<string>()
        {
            "Freda Curtis",
            "Jeffery Francis",
            "Eva Lawson",
            "Emmett Santos",
            "Theresa Bryan",
            "Jenny Fuller",
            "Terrell Norris",
            "Eric Wheeler",
            "Julius Clayton",
            "Alfredo Thornton",
            "Roberto Romero",
            "Orlando Mathis",
            "Eduardo Thomas",
            "Harry Douglas"
        };

        var panel = new StackLayout();
        panel.Children.Add(autoComplete);
        this.Content = panel;

        autoComplete.Focused += (object sender, FocusEventArgs e) =>
        {
            System.Diagnostics.Debug.WriteLine("Focused Event Fired");
        };

        autoComplete.Unfocused += (object sender, FocusEventArgs e) =>
        {
            System.Diagnostics.Debug.WriteLine("Unfocused Event Fired");
        };
    }

0 个答案:

没有答案