Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
XamDataGrid datasource on field
posted

I Have a method that add extra colums on a datagrid but I there is no data in it how can I add a DataSoure to the field. there are already a other datasource set on the grid  ?

private void konkurrenter_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
var selected = combokonkurrenter.SelectedItem as Konkurent;
if (selected != null)
{
var konkurrent = KonkurrenceDaekningDao.GetKonkurrenterById(selected.KonkurrentID);
UnboundField imageField = new UnboundField();

imageField.DataContext = new {data = konkurrent};
konkurrent.ForEach(dao =>
{
Console.WriteLine(dao.DækningsGrad);
} );
imageField.Label = selected.KonkurrentNavn;
imageField.Name = "Oplag";

dgKonkurrenter.FieldLayouts[0].Fields.Add(imageField);
}
}