I have a DataTemplate of an acollectionView, inside I have a Label with the Text in Binding property.
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid BackgroundColor="Gray" Opacity="0.8" RowSpacing="0.1">
<Label TextColor="White" Text="{Binding Data}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
I would need to be able to split that string into multiple strings, and I was able to find this code
public class DelimiterConverter : IValueConverter
{
public object Convert(Object value, Type targetType, object parameter, CultureInfo culture)
{
string[] values = ((string)value).Split(' ');
int index = int.Parse((string)parameter);
return values[index];
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return "";
}
}
HumorDiary[] note = JsonConvert.DeserializeObject<HumorDiary[]>(textt);
DelimiterConverter conv = new DelimiterConverter();
foreach (HumorDiary hd in note)
{
conv.Convert(hd.Data, typeof(string), " ", CultureInfo.CurrentCulture);
}
I don't know if I have entered everything right, but I would not know how to obtain the various strings divided into several parts, in the DataTemplate