Quantcast
Viewing all articles
Browse latest Browse all 18858

Adding array List into a Grid

Hi: I have a project in WPF C#. In my code, I am creating a new object(string object) from a loop and adding that string object in a List. Now in my XAML code I have added a Grid(myGrid). How Can I show the List of my Array objects in this Grid(Like a table). The Grid has 3 columns with heading: "Name", "Old Text", "New Text".

Some thing Like:

Public Class myObj

{

private string mname,mOldV, mNewV;

Class myObj(string name, string OldV, NewV)

{

mname =name;

mOldV=OldV;

mNewV= NewV;

}

}//end of myObj

Public class Mainclass

{

private List<MyObj> lObj=Null;

public sub asub

{

for(i=0, i<3,i++)

{

mObj = new MyObj("a",b","c"); //I will change this value

lObj[i].add =mObj;

}

myGrid.DataContext=mObj;//I dont know this one

}//end of asub

Qustion: I need the code part of the Grid in XAML to bind the List of myObj and also correct code(above) in C#.

Advance thanks

Syed 


Viewing all articles
Browse latest Browse all 18858

Trending Articles