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.
Unfortunately, activation email could not send to your email. Please try again.

How to handle events in SfAutoComplete for Xamarin.iOS platform

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.

 

 

 

namespace DelegateToEvent

{

public partial class ViewController : UIViewController

{

    protected ViewController(IntPtr handle) : base(handle)

    {

        // Note: this .ctor should not contain any initialization logic

    }

    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.

 

 

namespace DelegateToEvent

{

public partial class ViewController : UIViewController

{

    protected ViewController(IntPtr handle) : base(handle)

    {

        // Note: this .ctor should not contain any initialization logic

    }

    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.

 

 

namespace DelegateToEvent

{

public partial class ViewController : UIViewController

{

    protected ViewController(IntPtr handle) : base(handle)

    {

        // Note: this .ctor should not contain any initialization logic

    }

    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.

    }

}

}

 

 

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
8063 11/10/2017 11/10/2017 Xamarin.iOS SfAutoComplete
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.