diff --git a/README.md b/README.md
index a7c83dc..16071ec 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,67 @@
# itemtemplate-selector-listview-xamarin
ItemTemplateSelector listview xamarin
+
+## Sample
+
+```xaml
+
+
+
+
+
+
+
+
+
+Incoming Cell:
+
+
+ . . .
+ . . .
+
+
+
+Outgoing cell:
+
+
+ . . .
+ . . .
+
+
+
+DataTemplateSelector:
+
+class MyDataTemplateSelector : Xamarin.Forms.DataTemplateSelector
+{
+ public DataTemplate IncomingDataTemplate { get; set; }
+ public DataTemplate OutgoingDataTemplate { get; set; }
+
+ public MyDataTemplateSelector()
+ {
+ this.incomingDataTemplate = new DataTemplate(typeof(IncomingViewCell));
+ this.outgoingDataTemplate = new DataTemplate(typeof(OutgoingViewCell));
+ }
+
+ protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
+ {
+ var messageVm = item as Message;
+ if (messageVm == null)
+ return null;
+ return messageVm.IsIncoming ? this.incomingDataTemplate : this.outgoingDataTemplate;
+ }
+
+ private readonly DataTemplate incomingDataTemplate;
+ private readonly DataTemplate outgoingDataTemplate;
+}
+```
+
+