Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在列表框中显示对象属性_C#_Wpf - Fatal编程技术网

C# 在列表框中显示对象属性

C# 在列表框中显示对象属性,c#,wpf,C#,Wpf,我想从列表框中的对象列表中显示属性“Title”: <ListBox ItemsSource="{Binding SelectableSurveysByYear}" DisplayMemberPath="{Binding Title}" SelectedItem="{Binding SelectedSurvey}"> 我的缺点在哪里?哦。。该漏洞存在于定义DisplayMemberPath中。这项工作: <ListBox Items

我想从列表框中的对象列表中显示属性“Title”:

<ListBox ItemsSource="{Binding SelectableSurveysByYear}"
         DisplayMemberPath="{Binding Title}" 
         SelectedItem="{Binding SelectedSurvey}">

我的缺点在哪里?

哦。。该漏洞存在于定义DisplayMemberPath中。这项工作:

   <ListBox ItemsSource="{Binding SelectableSurveysByYear}"
         DisplayMemberPath="Title" 
         SelectedItem="{Binding SelectedSurvey}">


属性不支持
绑定
语法。请尝试以下操作:

<ListBox ItemsSource="{Binding SelectableSurveysByYear}"
     DisplayMemberPath="Title" 
     SelectedItem="{Binding SelectedSurvey}">

<ListBox ItemsSource="{Binding SelectableSurveysByYear}"
     DisplayMemberPath="Title" 
     SelectedItem="{Binding SelectedSurvey}">