Skip to content

Instantly share code, notes, and snippets.

void ItemsSourceChanged ()
{
if (ItemsSource == null) return;
CreateTabs();
}
void CreateTabs()
{
if(Children != null && Children.Count > 0) Children.Clear();
public HomePage(CarouselLayout.IndicatorStyleEnum indicatorStyle)
{
_indicatorStyle = indicatorStyle;
viewModel = new SwitcherPageViewModel();
BindingContext = viewModel;
Title = _indicatorStyle.ToString();
relativeLayout = new RelativeLayout
@chrisriesgo
chrisriesgo / CarouselViewWithVMViews.cs
Created July 12, 2015 15:37
An example showing how to have dynamic item templates driven off of the bound viewmodels.
public class App : Application
{
public IEnumerable<ICarouselViewModel> _pages;
public App()
{
_pages = new List<ICarouselViewModel>()
{
new PageOneViewModel(),
new PageTwoViewModel()
@chrisriesgo
chrisriesgo / CarouselLayout.cs
Created June 19, 2016 13:12
Remove all System.Timer references
// ...
async Task UpdateSelectedItem ()
{
await Task.Delay(300);
SelectedItem = SelectedIndex > -1 ? Children[SelectedIndex].BindingContext : null;
}
// ...
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
LoadApplication(new App());
}
public static class Constants
{
// Replace strings with your mobile services and gateway URLs.
public static string ApplicationURL = @"https://your-app-name.azurewebsites.net";
}
public class TodoItem : EntityData
{
string id;
string name;
bool done;
[JsonProperty(PropertyName = "id")]
public string Id
{
get { return id; }
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ActivityIndicator Grid.RowSpan="2"
HorizontalOptions="Center"
VerticalOptions="Center"
IsVisible="False"
IsEnabled="True"
public partial class TodoList : ContentPage
{
IEasyMobileServiceClient _client;
public TodoList(IEasyMobileServiceClient client)
{
InitializeComponent();
_client = client;
}
public partial class App : Application
{
public App()
{
InitializeComponent();
// 1. Create a new EasyMobileServiceClient.
var client = EasyMobileServiceClient.Create();
// 2. Initialize the library with the URL of the Azure Mobile App you created in Step #1.