We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to handle events in SfAutoComplete for Xamarin.iOS platform

Platform: Xamarin.iOS |
Control: SfAutoComplete

Handling event in SfAutoComplete:

In our latest 2017 Volume 4, we have removed Delegate API and SFAutoCompleteDelegate class from SfAutoComplete control. Here we have explained how to hook the events using event handler instead of delegates.

 

Handling FocusChanged event in SfAutoComplete :

FocusChanged event has been hooked by EventHandlers. The below codes explain how to hook the FocusChanged event using EventHandlers.

 

C#:

namespace DelegateToEvent
{
public partial class ViewController : UIViewController
{
    protected ViewController(IntPtr handle) : base(handle)
    {
    }
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
 
        SFAutoComplete autocomplete = new SFAutoComplete();
        autocomplete.Frame = new CoreGraphics.CGRect(10, 50, 200, 50);
 
        autocomplete.FocusChanged += (object sender, FocusEventArgs e) =>
        {
 
        };
 
        this.View.AddSubview(autocomplete);
 
 
    }
 
    public override void DidReceiveMemoryWarning()
    {
        base.DidReceiveMemoryWarning();
        // Release any cached data, images, etc that aren't in use.
    }
}
 
}
 

 

 

Handling ValueChanged event in SfAutoComplete :

ValueChanged event has been hooked by EventHandlers. The below codes explain how to hook the ValueChanged event using EventHandlers.

 

C#:

namespace DelegateToEvent
{
public partial class ViewController : UIViewController
{
    protected ViewController(IntPtr handle) : base(handle)
    {
    }
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
 
        SFAutoComplete autocomplete = new SFAutoComplete();
        autocomplete.Frame = new CoreGraphics.CGRect(10, 50, 200, 50);
 
        autocomplete.ValueChanged += (object sender, EventArgs e) =>
        {
            double Value = Convert.ToDouble(e.Value.ToString());
        };
 
        this.View.AddSubview(autocomplete);
        }
 
    public override void DidReceiveMemoryWarning()
    {
        base.DidReceiveMemoryWarning();
        // Release any cached data, images, etc that aren't in use.
    }
}
}
 
 

 

Handling SelectionChanged event in SfAutoComplete :

SelectionChanged event has been hooked by EventHandlers. The below codes explain how to hook the SelectionChanged event using EventHandlers.

C#:

namespace DelegateToEvent
{
public partial class ViewController : UIViewController
{
    protected ViewController(IntPtr handle) : base(handle)
    {
    }
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
 
        SFAutoComplete autocomplete = new SFAutoComplete();
        autocomplete.Frame = new CoreGraphics.CGRect(10, 50, 200, 50);
 
        autocomplete.SelectionChanged += (object sender, SelectionEventArgs e) =>
        {
            double Value = Convert.ToDouble(e.Value.ToString());
        };
 
        this.View.AddSubview(autocomplete);
    }
 
    public override void DidReceiveMemoryWarning()
    {
        base.DidReceiveMemoryWarning();
        // Release any cached data, images, etc that aren't in use.
    }
}
}
 
 

 

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile