Search code examples
xamlstring-formattingmaui

Separate list of string values with a comma but not the last item using StringFormat in XAML .NET MAUI


I want to separate list of string values with a comma but not the last item using StringFormat in XAML .NET MAUI. To place a comma between each item, I will set the StringFormat as follow (this is a sample code):

 <Label  Text="{Binding Name, StringFormat='{0} ,' }"/>

But how can I avoid having the comma after the last item?


Solution

  • This can be done only in the code behind.