I have a RefItem with a list of Models. I want now to display the Description-Property of each model in one DataGrid-Cell like this:
35 hours, 10 hours, 3 hours
I firstly thought of a converter, but C# requires an IValueConverter, whereas the object-parameter is there only a string and theoretically, an IMultiValueConverter is required.
My DataGrid-Cell looks like this:
<DataGridTextColumn x:Name="txtScopeOfCare" Header="Scope of Care"
IsReadOnly="true" Binding="{Binding Path=CareModel.Description}" />
Of course, this Binding does not work, because it is a list. Does someone have a clue how to achieve this? :)
CodePudding user response:
Why not just create another property and bind to that?
public string Description => string.Join(",", CareModel.Select(c => c.Description));
<DataGridTextColumn x:Name="txtScopeOfCare" Header="Scope of Care"
IsReadOnly="true" Binding="{Binding Path=Description, Mode=OneTime}" />
I'm not sure what you are referring to as a list
, if Description
is the list, you can do this instead:
public string Description => string.Join(",", CareModel.Description);