This is a migrated thread and some comments may be shown as answers.

Binding in EmptyContentTemplate

2 Answers 48 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Igor
Top achievements
Rank 1
Igor asked on 10 Mar 2014, 01:39 PM
Is there a way to use binding in EmptyContentTemplate? My ViewModel has a Name property that I want to use in a Run in the EmptyContentTemplate, but I am getting

System.Windows.Data Error: BindingExpression path error: 'Name' property not found on '' 'System.String' (HashCode=757602046). BindingExpression: Path='Name' DataItem='' (HashCode=757602046); target element is 'System.Windows.Documents.Run' (Name='null'); target property is 'Text' (type 'System.String')..

It looks like the EmptyContentTemplate does not even now about the ViewModel and has its DataContent set to some string.

2 Answers, 1 is accepted

Sort by
0
Igor
Top achievements
Rank 1
answered on 10 Mar 2014, 02:34 PM
The tricks seems to be to set EmptyDataContent="{Binding}"
0
Deyan
Telerik team
answered on 13 Mar 2014, 12:08 PM
Hi Igor,

Thanks for writing.

Yes, that's what you need to do to get it working.

Regards,
Deyan
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
DataBoundListBox
Asked by
Igor
Top achievements
Rank 1
Answers by
Igor
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or