Manipulate DisplayMember before displaying it

Let's say I use data binding as follows:

List<Entity> Entities = <some data> entityBinding.DataSource = Entities; lstEntities.DisplayMember = "Description"; 

which works great. However, I want to manipulate the string that returns as the Entity Description. How can I call a function in DisplayMember?

+4
source share
1 answer

You cannot call a function in this field, but you can create a new property in your entity called MyDescription , which does Description what you want to do, and then use this new property as your DisplayMember

+2
source

Source: https://habr.com/ru/post/1308541/


All Articles