Skip to content

Commit d146e90

Browse files
Updated the README.md file
1 parent 85fbd2f commit d146e90

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,82 @@
11
# show-drop-down-menu-on-tapping-a-message-in-Xamarin.Forms.Chat
22
Describes how to show a drop down menu with options upon tapping a message in Xamarin.Forms.Chat(SfChat)
3+
4+
## Sample
5+
6+
```xaml
7+
8+
<ResourceDictionary>
9+
<Style TargetType="sfChat:IncomingMessageAuthorView">
10+
<Setter Property="ControlTemplate">
11+
<Setter.Value>
12+
<ControlTemplate>
13+
<StackLayout Orientation="Horizontal">
14+
<Label Text="{Binding Author.Name}" HorizontalTextAlignment="Start" BackgroundColor="Transparent" BindingContext="{TemplateBinding BindingContext}"/>
15+
<Image HorizontalOptions="EndAndExpand" Source="GroupExpander.png" HeightRequest="20" WidthRequest="20">
16+
<Image.GestureRecognizers>
17+
<TapGestureRecognizer Tapped="OnImageTapGestureRecognizerTapped"/>
18+
</Image.GestureRecognizers>
19+
</Image>
20+
</StackLayout>
21+
</ControlTemplate>
22+
</Setter.Value>
23+
</Setter>
24+
</Style>
25+
</ResourceDictionary>
26+
</ContentPage.Resources>
27+
28+
<ContentPage.Content>
29+
<sfPopup:SfPopupLayout x:Name="popupLayout">
30+
<sfPopup:SfPopupLayout.PopupView>
31+
<sfPopup:PopupView ShowHeader="False" ShowFooter="False" AutoSizeMode="Both">
32+
<sfPopup:PopupView.ContentTemplate>
33+
<DataTemplate>
34+
<StackLayout>
35+
<StackLayout.GestureRecognizers>
36+
<TapGestureRecognizer Tapped="OnLabelTapGestureRecognizerTapped"/>
37+
</StackLayout.GestureRecognizers>
38+
...
39+
</DataTemplate>
40+
</sfPopup:PopupView.ContentTemplate>
41+
</sfPopup:PopupView>
42+
</sfPopup:SfPopupLayout.PopupView>
43+
<sfPopup:SfPopupLayout.Content>
44+
<Grid x:Name="chatGrid">
45+
<Grid.RowDefinitions>
46+
<RowDefinition Height="*"/>
47+
</Grid.RowDefinitions>
48+
49+
<sfChat:SfChat x:Name="sfChat"
50+
Grid.Row="0"
51+
AllowMultilineInput="True"
52+
Messages="{Binding Messages}"
53+
CurrentUser="{Binding CurrentUser}">
54+
</sfChat:SfChat>
55+
</Grid>
56+
</sfPopup:SfPopupLayout.Content>
57+
</sfPopup:SfPopupLayout>
58+
</ContentPage.Content>
59+
60+
Code behind:
61+
62+
void OnImageTapGestureRecognizerTapped(object sender, EventArgs args)
63+
{
64+
popupLayout.ShowAtTouchPoint();
65+
}
66+
67+
void OnLabelTapGestureRecognizerTapped(object sender, EventArgs args)
68+
{
69+
popupLayout.Dismiss();
70+
}
71+
72+
```
73+
74+
## Requirements to run the demo
75+
76+
To run the demo, refer to [System Requirements for Xamarin](https://help.syncfusion.com/xamarin/system-requirements)
77+
78+
## Troubleshooting
79+
80+
### Path too long exception
81+
82+
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.

0 commit comments

Comments
 (0)