Skip to content

Instantly share code, notes, and snippets.

@almirvuk
Last active August 3, 2017 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save almirvuk/a6f227fbbf40524ec65d75f118427eec to your computer and use it in GitHub Desktop.
Save almirvuk/a6f227fbbf40524ec65d75f118427eec to your computer and use it in GitHub Desktop.
using CarsExample.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace CarsExample.ViewModels {
public class CarsViewModel : INotifyPropertyChanged {
private ObservableCollection<Car> items;
public ObservableCollection<Car> Items {
get { return items; }
set {
items = value;
}
}
public CarsViewModel() {
// Here you can have your data form db or something else,
// some data that you already have to put in the list
Items = new ObservableCollection<Car>() {
new Car()
{
CarID = 1,
Make = "Tesla Model S",
YearOfModel = 2015
},
new Car()
{
CarID = 2,
Make = "Audi R8",
YearOfModel = 2012
},
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment