--- title: How to add context menu to the RadListView Item description: context menu inside a listview item type: how-to page_title: How to add context menu to the RadListView Item slug: listview-contextmenu-in-item position: tags: listview, contextmenu, xamarin, XamarinForms, RadListView, add ticketid: 1424187 res_type: kb --- ## Environment
Product Version 2019.2.802.1
Product ListView for Xamarin Cross-Platform
## Description This article shows how to add a context menu to the ListView item. ## Solution This scenario could be achieved for example, with [RadButton]({%slug button-overview%}), [RadPopup]({%slug popup-overview%}) controls. We can use the [Telerik Font Icons]({%slug telerik-font-icons%}) to set icon to the RadButton **Text** property instead of text. ## Example Let's create a business model for the items: ```C# public class DataItem : Telerik.XamarinForms.Common.NotifyPropertyChangedBase { private string name; private bool isPopupOpen; public DataItem(string personName) { Name = personName; } public string Name { get => name; set => UpdateValue(ref name, value); } public bool IsPopupOpen { get => isPopupOpen; set => UpdateValue(ref isPopupOpen, value); } } ``` Then, in the view model, let's create some sample names to populate the data source and a command that will toggle the IsPopupOpen property of that item: ```C# public class ViewModel { public ViewModel() { this.People = new ObservableCollection() { new DataItem("Freda Curtis"), new DataItem("Jeffery Francis"), new DataItem("Eva Lawson"), new DataItem("Emmett Santos"), new DataItem("Theresa Bryan"), new DataItem("Jenny Fuller") }; OpenContextMenuCommand = new Command(item => item.IsPopupOpen = !item.IsPopupOpen); } public ObservableCollection People { get; set; } public Command OpenContextMenuCommand { get; } } ``` Finally, the XAML, uses a RadPopup in the ItemTemplate with a slight offset. Here are the important takeaways: - The control's **IsOpen** property is bound to the model's **IsPopupOpen** property. - The Button Command uses **x:Reference** to get to the view model command property. ```XAML telerikfontexamples Fonts/telerikfontexamples.ttf#telerikfontexamples /Assets/Fonts/telerikfontexamples.ttf#telerikfontexamples WhiteSmoke ``` Here is the final result: ![BusyIndicator example](images/listview-contextmenu-item.png)