I know this has been asked already but I have done almost everything what is suggested by developers.
<DataGrid x:Name="Imported" VerticalAlignment="Top" DataContext="{Binding Source=list}" AutoGenerateColumns="False" CanUserResizeColumns="True">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding Path=ID}"/>
<DataGridTextColumn Header="Date" Binding="{Binding Path=Date}"/>
</DataGrid.Columns>
</DataGrid>
I am trying to show this in modal dialog box and populating the license list in the constructor of the modal dialog box. But still nothing is getting populated inside the datagrid.
Constructor code:
public diagboxclass()
{
List<object> list = new List<object>();
list = GetObjectList();
}
public class object
{
string id;
DateTime date;
public string ID
{
get { return id; }
set { id = value; }
}
public DateTime Date
{
get { return date; }
set { date = value; }
}
}
Do you guys think something to do with the object list?
list
is defined) so we can help further. – Dan Jdiagboxclass
? What type is the XAML classcontaining
the DataGrid? Ifdiagboxclass
is in the code-behind of the XAML file, you should assignlist
to theDataContext
property of that class. You should then be able to bind to list from within the XAML. – Dan J