diff --git a/README.md b/README.md index 9909aa3..d21a901 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,73 @@ # assign-unique-color-to-each-user-name-and-message-in-a-group-chat-in-Xamarin.Forms.Chat Describes how to assign a separate color to each user in a group chat to display that user's name and that user's message in one unique color. + +## Sample + +```xaml + + + + + + + + + + + + + +Converter: + + public class AuthorColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var viewModel = parameter as ViewModel; + var message = value as IMessage; + + if (viewModel.AuthorColors.ContainsKey(message.Author)) + { + Color color; + viewModel.AuthorColors.TryGetValue(message.Author, out color); + return color; + } + else + { + return viewModel.AddColorForAuthor(message.Author); + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return Color.White; + } + } + +``` + +## Requirements to run the demo + +To run the demo, refer to [System Requirements for Xamarin](https://help.syncfusion.com/xamarin/system-requirements) + +## Troubleshooting + +### Path too long exception + +If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.