I set up ItemSource for the ListBox with converter:
<ListBox Name="FunctionsListBox"
ItemsSource="{Binding Path=Functions,
Converter={x:Static app:CreatorWindow.FunctionConverter}}"/>
However this looks for me ugly, because converter converts entire collection -- I would prefer more versatile converter which converts just single item. I can write without a problem, but how to force ListBox to call converter one by one, instead of all items at once?
I know I can be more elaborate and define ItemTemplate for ListBox:
<ListBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding Converter={x:Static app:CreatorWindow.FunctionConverter}}"/>
</DataTemplate>
</ListBox.ItemTemplate>
But this interferes with the widget used by ListBox and it is a bit lengthy.
So how to do it -- in short manner? Sorry for being picky, I just like a clean code :-)
Off-topic
Because I sense (and see) the answers can go in completely wrong direction, this is my FunctionConverter.
FunctionConverter = LambdaConverter.Create((GeneratorEnum e) => GeneratorsFactory.GeneratorNames[e],
(string s) => GeneratorsFactory.GeneratorNames[s]);
So I have backend, where I can access data, and it is UI-agnostic, and I have UI. To establish link between backend and frontend, I use converters as above. This is minimal code approach and it is flexible.
GeneratorNames is associative array with unique keys and values, so you can query it using value or key as an index.
Adding new layer between does NOT really solve my problem, does NOT answer my question, and even if I would be interested it adds a lot of code (and that is exactly why I am not interested -- above you see 2-liner, if anything is better it has to be in only one line).