Posted on Nov 20, 2011 (permalink)
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
"OuterGrid"
"InnerStackPanel"
Width
"600"
Height
"450"
ListBox
"lstBox"
ListBoxItem
AllowDrop
"True"
"50"
Orientation
"Horizontal"
"lstboxStackPanel"
telerik:RadExpander
"360"
"SplInsideExpander"
TextBlock
"TxtEmpAddress"
Text
"{Binding EmpAddress}"
></
"TxtEmpCity"
"{Binding EmpCity}"
</
"TxtEmpName"
"{Binding EmpName}"
xml:space
"preserve"
"TxtEmpid"
"{Binding EmpId}"
public void BindEmpDetails()
{
List<
EmployeeDetails
> lste = new List<
>();
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
Reply
Posted on Nov 21, 2011 (permalink)
"1200"
"400"
VerticalAlignment
"Top"
ItemsSource
ListBox.ItemTemplate
DataTemplate
telerik:RadExpander.Header
"TestRadExpanderHeader"
"Auto"
"Grd1"
Grid.RowDefinitions
RowDefinition
"*"
Grid.ColumnDefinitions
ColumnDefinition
Grid.Row
"0"
Grid.Column
"1"
TextWrapping
"Wrap"
"SplInsideExpander1"
"2"
<!--<TextBlock x:Name="TxtEmpCity" Text="{Binding EmpCity}" Width="Auto" TextWrapping="Wrap"></TextBlock>-->
public List<
MyEmployeeDetails
> lstMyEmployeeDetails = new List<
public void BindToExpander()
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("Employee Address Employee Address Employee Address Employee Address Employee Address Employee Address Employee Address Employee Address Employee Address Employee Address");
sb.Append("Employee Address Employee Address Employee Address Employee Address Employee Address Employee Address" + i);
MyEmployeeDetails objMyEmployeeDetails = new MyEmployeeDetails();
objMyEmployeeDetails.EmpId = i;
objMyEmployeeDetails.EmpName = "Employee Name " + i;
objMyEmployeeDetails.EmpAddress = sb.ToString();
objMyEmployeeDetails.EmpCity = "Employee City Employee City Employee City Employee City Employee City Employee City" + i;
lstMyEmployeeDetails.Add(objMyEmployeeDetails);
lstBox.ItemsSource = lstMyEmployeeDetails;
Back to Top
[ Silverlight Expander Features | Documentation | Demos | Telerik TV | Self-Paced Trainer ]
UI controls for ASP.NET AJAX, MVC, WPF, Silverlight, Windows Forms and Windows Phone. Visual Studio productivity tools. Reporting and data layer solutions.
HTML5 / JavaScript tools for Web and Mobile applications
Functional, Performance, Load and Mobile Software Testing
CMS, Mobile Web, Ecommerce, Emarketing, Social Media
Project management software inspired by Agile best practices
It seems you haven't bookmarked any pages. Fix that by clicking the button below