How to animate content view width in xamarin forms

  • Thread starter Thread starter Gayathri_Manickam
  • Start date Start date
G

Gayathri_Manickam

Guest
In content view, I created custom control and try to animate to the width size when clicking the button.

Animation works well on the content page but animation doesn't work when I try to use the custom control on the content page.

How can i achieve animation by using content view ?

Thanks,
if (this.titleView != null)
{
double opacity;

// Animating Width of the search box, from 0 to full width when it added to the view.
var expandAnimation = new Animation(
property =>
{
searchEntryBackLayout.WidthRequest = property;
opacity = property / titleView.Width;
searchEntryBackLayout.Opacity = opacity;
}, 0, titleView.Width, Easing.Linear);

expandAnimation.Commit(searchEntryBackLayout, "Expand", 16, 250, Easing.Linear, (p, q) => this.SearchExpandAnimationCompleted());
}


private void SearchExpandAnimationCompleted()
{
this.searchEntry.Focus();
}

Continue reading...
 
Back
Top