HomeWindowsDataBinding a ContextMenu in Windows Phone

DataBinding a ContextMenu in Windows Phone

In this blog post , i will demonstrate how one can populate the Context menu via Data Binding .

The context menu like other Data controls too have an ItemSource property.

DataBinding a ContextMenu in Windows Phone

In the below sample source code , i have used the List of string and binded it to the context menu and the context menu is set for the text box .

ContextMenu PopUpMenu = new ContextMenu();
List MenuData = new List();
MenuData.Add("Windows Phone");
MenuData.Add("Android");
MenuData.Add("iPhone");
MenuData.Add("BlackBerry");
PopUpMenu.ItemsSource = MenuData;
ContextMenuService.SetContextMenu(this.textBox1, PopUpMenu);
DataBinding a ContextMenu in Windows Phone
DataBinding a ContextMenu in Windows Phone

 

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...