How to bind related data many to many for example:
public class Post { public int PostId { get; set; } public string Title { get; set; } public ICollection<PostTag> PostTags { get; } = new List<PostTag>(); } public class Tag { public int TagId { get; set; } public string Text { get; set; } public ICollection<PostTag> PostTags { get; } = new List<PostTag>(); } public class PostTag { public int PostId { get; set; } public Post Post { get; set; } public int TagId { get; set; } public Tag Tag { get; set; } } Receiving:
var Post_Tag = db.Posts.Include(a=>a.PostTags).ThenInclude(a=>a.Tag).ToList(); Items= new ObservableCollection<Abonoment>(); Post_Tag .ForEach(Items.Add); <ComboBox x:Name="Combo" DisplayMemberPath="Title" ItemsSource="{Binding Items}"/> <TextBlock Text="{Binding ElementName=Combo, Path=SelectedValue.PostTags.Tag.Text}" /> How to get Text from Tag?
SelectedValue.PostTags.Tag.Text, which Tag do you mean? The first? Last? Tenth? Seventh from the end? - Andrei NOPPath=SelectedValue.PostTags[0].Tag.Text- Andrey NOP