The animation when changing view is somewhat sluggish. Atm I'm using the Genymotion emulator but I've tried on a Galaxy S2 as well and the results were similar..
Any suggestions on what could/should be done differently?
Here is the code:
`
using System;
using System.ComponentModel;
using System.Windows.Input;
using Xamarin.Forms;
namespace Testing
{
public class TestViewModel : BaseViewModel // BaseViewModel is basically empty atm
{
ICommand btnTestCommand;
public ICommand BtnTestCommand
{
get { return btnTestCommand; }
set
{
if (btnTestCommand == value)
return;
btnTestCommand = value;
OnPropertyChanged ();
}
}
public TestViewModel ()
{
BtnTestCommand = new Command (() => {
Navigation.PushAsync(new TestView(new TestViewModel()));
}
);
}
}
}
using System;
using Xamarin.Forms;
namespace Testing
{
public class TestView : ContentPage
{
public TestView (BaseViewModel basemodel)
{
BindingContext = basemodel;
basemodel.Navigation = Navigation;
NavigationPage.SetHasNavigationBar (this, true);
var stack = new StackLayout {
Orientation = StackOrientation.Vertical,
Padding = new Thickness(0, 25, 0, 25)
};
Label header = new Label
{
Text = "MyHeader",
TextColor = Color.FromHex("00ff00"),
//Font = Font.BoldSystemFontOfSize(25),
HorizontalOptions = LayoutOptions.Center
};
Label lblA = new Label
{
Text = "lblA",
TextColor = Color.FromHex("00ff00"),
//Font = Font.BoldSystemFontOfSize(25),
HorizontalOptions = LayoutOptions.Center
};
Label lblB = new Label
{
Text = "lblB",
TextColor = Color.FromHex("00ff00"),
Font = Font.BoldSystemFontOfSize(25),
HorizontalOptions = LayoutOptions.Center
};
var btnTest = new Button {
Text = "MyButton",
BackgroundColor = Color.FromHex ("ff0000"),
TextColor = Color.White,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Start,
WidthRequest=200,
};
btnTest.SetBinding (Button.CommandProperty, "BtnTestCommand");
stack.Children.Add (header);
stack.Children.Add (btnTest);
stack.Children.Add (lblA);
stack.Children.Add (lblB);
Content = stack;
}
}
}
`