开发者

Can I use an IConverter on a ListBoxItem whose parent ListBox.ItemsSource is bound to a list<int>

I don't know how to bind to an int since it has no properties.

<ListBox Name="AgencyTypeListBox"  >
 <ListBox.ItemTemplate >
  <DataTemplate>
   <TextBlock Text="{Binding Path=whatDoIPutHere, Converter={BLL:CodeMarkupExtension}}" />
  </DataTemplate>
 </ListBox.ItemTemplate>开发者_如何学运维
</ListBox>

In my code behind I do this

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


If the ItemsSource is a list of ints, the data context of each item will already be an integer list entry; you don't need to specify any path.

<TextBlock Text="{Binding Converter={BLL:CodeMarkupExtension}}" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜