protected override void OnAttachedTo(SampleView bindable)
 {
     base.OnAttachedTo(bindable);
     tap              = new TapGestureRecognizer();
     tap.Tapped      += ScrollToBottom;
     this.sampleView  = bindable;
     this.sfChat      = bindable.FindByName <Syncfusion.XForms.Chat.SfChat>("sfChat");
     this.viewModel   = bindable.FindByName <GettingStartedViewModel>("viewModel");
     this.sfBadgeView = bindable.FindByName <Syncfusion.XForms.BadgeView.SfBadgeView>("ScrollDown");
     this.sfBadgeView.GestureRecognizers.Add(tap);
     this.viewModel.Messages.CollectionChanged += MessageCollectionChanged;
     this.sfChat.Scrolled       += ChatScrolled;
     badgeSetting                = new Syncfusion.XForms.BadgeView.BadgeSetting();
     badgeSetting.BadgeType      = Syncfusion.XForms.BadgeView.BadgeType.Primary;
     badgeSetting.BadgeAnimation = Syncfusion.XForms.BadgeView.BadgeAnimation.None;
     badgeSetting.BadgePosition  = Syncfusion.XForms.BadgeView.BadgePosition.TopLeft;
     if (Device.RuntimePlatform == "Android")
     {
         badgeSetting.Offset = new Point(-1, 1);
     }
     else if (Device.RuntimePlatform == "UWP")
     {
         badgeSetting.Offset = new Point(-7, -10);
     }
     else
     {
         badgeSetting.Offset = new Point(0, -1);
     }
     sfBadgeView.WidthRequest  = 60;
     badgeSetting.FontSize     = 10;
     sfBadgeView.BadgeSettings = badgeSetting;
 }
 /// <summary>
 /// Clears the instances used in this sample.
 /// </summary>
 private void Dispose()
 {
     this.sfChat.Scrolled -= ChatScrolled;
     if (this.sfChat != null)
     {
         this.sfChat.Dispose();
         this.sfChat = null;
     }
     if (this.viewModel != null)
     {
         this.viewModel = null;
     }
 }