Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.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# 我可以在其父ListBox.ItemsSource绑定到列表的ListBoxItem上使用IConverter吗<;int>;_C#_Wpf_Xaml_Data Binding - Fatal编程技术网

C# 我可以在其父ListBox.ItemsSource绑定到列表的ListBoxItem上使用IConverter吗<;int>;

C# 我可以在其父ListBox.ItemsSource绑定到列表的ListBoxItem上使用IConverter吗<;int>;,c#,wpf,xaml,data-binding,C#,Wpf,Xaml,Data Binding,我不知道如何绑定到int,因为它没有属性 <ListBox Name="AgencyTypeListBox" > <ListBox.ItemTemplate > <DataTemplate> <TextBlock Text="{Binding Path=whatDoIPutHere, Converter={BLL:CodeMarkupExtension}}" /> </DataTemplate> </ListB

我不知道如何绑定到int,因为它没有属性

<ListBox Name="AgencyTypeListBox"  >
 <ListBox.ItemTemplate >
  <DataTemplate>
   <TextBlock Text="{Binding Path=whatDoIPutHere, Converter={BLL:CodeMarkupExtension}}" />
  </DataTemplate>
 </ListBox.ItemTemplate>
</ListBox>

在我的代码背后,我这样做

AgencyTypeListBox.ItemsSource = (List<int>) someListofInts; 
AgencyTypeListBox.ItemsSource=(List)someListofInts;

如果ItemsSource是一个INT列表,则每个项目的数据上下文将已经是一个整数列表条目;您不需要指定任何路径


如果ItemsSource是一个INT列表,则每个项目的数据上下文将已经是一个整数列表条目;您不需要指定任何路径