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}}" />
精彩评论