List and Binding on C#

 

 

private
List<bookstore> List_of_boox;


public MainPage()

{


this.InitializeComponent();

List_of_boox = books();

}

 


public
static
List<bookstore> books() {


var list = new
List<bookstore>();

 

list.Add(new
bookstore() { id_book = 1, book_name = “Libro_1”, book_notes = “Nota_1” });

list.Add(new
bookstore() { id_book = 2, book_name = “Libro_2”, book_notes = “Nota_2” });

list.Add(new
bookstore() { id_book = 3, book_name = “Libro_3”, book_notes = “Nota_3” });

list.Add(new
bookstore() { id_book = 4, book_name = “Libro_4”, book_notes = “Nota_4” });

list.Add(new
bookstore() { id_book = 5, book_name = “Libro_5”, book_notes = “Nota_5” });

 


return list;

 

}

 

 


public
class
bookstore {


public
int id_book { get; set; }


public
string book_name { get; set; }


public
string book_notes { get; set; }

 

 

}

 


private
void list_1_SelectionChanged(object sender, SelectionChangedEventArgs e)

{


Debug.WriteLine(list_1.SelectedValue);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s