Frage

Let's say I have class with Name property. I'd like to bind collection of objects of this class to Silverlight 3 ListBox. But I want to show items like that:

  • "Some dynamic str " + Name (object property)
  • "Some dynamic str " + Name (object property)
  • "Some dynamic str " + Name (object property)

How can I achieve this without use of converters?

Can I use function for each item to format display value?

War es hilfreich?

Lösung

Silverlight 3 does NOT support the StringFormat Binding option: Does Silverlight support StringFormat in binding?

You could use a ValueConverter but if you do not want that as mentioned in your question you might want to consider either:

Changing the ViewModel property so it returns the correct text or

adding extra TextBlocks in the View that prefix the text with "Some str".

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top