This question is locked. New answers and comments are not allowed.
Hi,
I have got a scenario where I need to have a textblock inside the expander, Now when I try to bind the items, I am not able to view any items. I could not figure out what the problem is. Please find the codings which I have added.
<StackPanel x:Name="OuterStack" DataContext="{Binding}"> <Grid x:Name="OuterGrid"> <StackPanel x:Name="InnerStackPanel" Width="600" Height="450" > <ListBox x:Name="lstBox"> <ListBoxItem AllowDrop="True" Height="50"> <StackPanel Orientation="Horizontal" x:Name="lstboxStackPanel"> <telerik:RadExpander Width="360"> <StackPanel x:Name="SplInsideExpander" Orientation="Horizontal"> <TextBlock x:Name="TxtEmpAddress" Text="{Binding EmpAddress}"></TextBlock> <TextBlock x:Name="TxtEmpCity" Text="{Binding EmpCity}"></TextBlock> </StackPanel> </telerik:RadExpander> <TextBlock x:Name="TxtEmpName" Text="{Binding EmpName}" xml:space="preserve"></TextBlock> <TextBlock x:Name="TxtEmpid" Text="{Binding EmpId}"></TextBlock> </StackPanel> </ListBoxItem> </ListBox> </StackPanel> </Grid> </StackPanel>In the Code behind I have the following code
public void BindEmpDetails() { List<EmployeeDetails> lste = new List<EmployeeDetails>(); for (int i = 0; i < 10; i++) { EmployeeDetails obj = new EmployeeDetails(); obj.EmpId = i.ToString(); obj.EmpName = "Emp Name" + i; obj.EmpCity = "City " + i; obj.EmpAddress = "Address " + i; lste.Add(obj); } OuterStack.DataContext = lste; }public class EmployeeDetails { public string EmpId { get; set; } public string EmpName { get; set; } public string EmpAddress { get; set; } public string EmpCity { get; set; } }Please let me know where I am going wrong? thx in advance