namespace BusinessLayer.Structure
{
public class GroupList : ObservableCollection
{
public GroupList()
{
Manager.PrepareData _groups = new Manager.PrepareData(); // get ObservableCollection
foreach(Group group in _groups.LoadGroups())
{
this.Add(group);
}
}
}
}
namespace BusinessLayer.Structure
{
public class Group
{
public Guid ID_Group { get; set; }
public string Name_Group { get; set; }
}
}
namespace BusinessLayer.Structure
{
public class Contact
{
public Guid Id { get; set; };
public string Name { get; set; };
public string Surname { get; set; };
public string Group { get; set; };
public string Address { get; set; };
}
}
How can I bind data in DataGrid in XAML? DataGrid is in PresentationLayer namespace.
DisplayMemberPath="Name"
ItemsSource="{Binding Path=DataContext.GroupList,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
IsReadOnly="True" />
I tried a lot of ideas but no solution. Could someone help me, please? Thanks
Replies
Know the answer? Post it — somebody with the same question will find it here.