C# Code-
namespace WPFDataBinding
{
public partial class MainWindow : Window
{
public Person Obj { get; set; }
public MainWindow()
{
InitializeComponent();
Obj = new Person();
List<string> subjects1 = new List<string>();
subjects1.Add("C"); subjects1.Add("C++"); subjects1.Add("C#");
List<string> subjects2 = new List<string>();
subjects2.Add("JAVA"); subjects2.Add("JS"); subjects2.Add("CSS");
Obj.studDetail.Add("Kush", subjects1);
Obj.studDetail.Add("Yash", subjects2);
DataContext = this;
}
public class Person
{
private Dictionary<string, List<string>> StudDetail = new Dictionary<string, List<string>>();
public Dictionary<string, List<string>> studDetail
{
get { return StudDetail; }
set { StudDetail = value; }
}
}
}
}
WPF code------
<ListBox FontSize="20" Height="Auto" Width="Auto" MinHeight="100" MinWidth="100" Background="Gray">
<Label Content="{Binding Obj}">
<Label.ContentTemplate>
<DataTemplate>
<ListBox Height="Auto" FontSize="20" MinHeight="100"
MinWidth="100" Width="Auto" Name="Sub1"
ItemsSource="{Binding studDetail}"/>
</DataTemplate>
</Label.ContentTemplate>
</Label>
</ListBox>
namespace WPFDataBinding
{
publi