Skip to content

Instantly share code, notes, and snippets.

View aboutviewmodel.cs
public class AboutViewModel : BaseViewModel
public AboutViewModel()
Title = "About";
OpenWebCommand = new Command(async () => await Browser.OpenAsync(""));
public ICommand OpenWebCommand { get; }
View xamlbutton.xaml
<Button Margin="0,10,0,0" Text="Learn more"
Command="{Binding OpenWebCommand}"
BackgroundColor="{StaticResource Primary}"
TextColor="White" />
View AppShell.xaml
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.ForegroundColor" Value="White" />
<Setter Property="Shell.TitleColor" Value="White" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
View app.xaml
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns=""
Define global resources and styles here, that apply to all pages in your app.
<Color x:Key="Primary">#2196F3</Color>
lewcianci / main.dart
Created Jun 28, 2021
A simple todo app in Flutter
View main.dart
import 'package:flutter/material.dart';
void main() {
class MyApp extends StatelessWidget {
// This widget is the root of your application.
Widget build(BuildContext context) {
View gist:5444fbaafeefbae32b3998cdbcc540c8
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
View gist:7aca6fc86eb12ca005347ad4dbf453a7
private async void OnSave()
Item newItem = new Item()
Id = Guid.NewGuid().ToString(),
Text = Text,
Description = Description
await DataStore.AddItemAsync(newItem);
View gist:76040573e4cdf2221bb3d7081bb668b8
public NewItemViewModel()
SaveCommand = new Command(OnSave, ValidateSave);
CancelCommand = new Command(OnCancel);
this.PropertyChanged +=
(_, __) => SaveCommand.ChangeCanExecute();
View viewmodel
public Command SaveCommand { get; }
public Command CancelCommand { get; }
View gist:f24e0291623de080821e629710f153d5
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using testxamarin.Models;
using Xamarin.Forms;
namespace testxamarin.ViewModels
public class NewItemViewModel : BaseViewModel