31.01.2020

Change Context On Item In Context View

Before reading this article, please go through the article's link, given below-. Reading this article, you can learn, how to Create Context Menu, using List View and MenuFlyout controls in Universal Windows apps development with XAML and Visual C#. The following important tools are required to developing UWP-. Windows 10 (Recommended). Visual Studio 2015 Community Edition (It is a free software available online). Now, we can discuss step by step app development.

Mk ultra power tab for mac. Step1 - Open Visual Studio 2015 - Start - New Project- Select Universal (under Visual C#-Windows)- Blank App - Give the suitable name for your app (UWPContextMenu) -OK. Step 2 - Choose Target and minimum platform version your Windows Universal Application will support.

Afterwards, the project creates App.xaml and MainPage.xaml. Step 3 - Open (double click) the file MainPage.xaml in the Solution Explorer and click Toolbox tab on the left to open the list of Common XAML controls. Expand Common XAML Controls and drag the required control to the middle of the design canvas Add TextBlock control and change the name and text property Subsequently, change the Textblock font size. Afterwards, drag and drop the List View control. You have to change the name property. Now, you can add the items for List view Control. The item type is String and to add string item, first you have to select other type and select the String object.

Now, you have added 4 string items and given the property name also. Now, your List View looks like: Step 4 - Next, you can add the Menu Flyout Control, give the Key and define with ListView control. Now, set the name property of the MenuFlyout control. Add 2 Items for Menuflyout. Change the name and text Property for MenuFlyoutItem. Step 5 - Add an event method for RightTapped (just double click the event method in property Window, automatically the LVContextMRightTapped event method will generate in MainPage.Xaml.cs). The code, given below, will be be added in the LVContextMRightTapped to add feature for Sub menu.

Change Context On Item In Context Viewer

Change context on item in context viewerChange context on item in context views

ListView listView = (ListView)sender;. MenuFlyoutContext.ShowAt(listView, e.GetPosition(listView));. var a = ((FrameworkElement)e.OriginalSource).DataContext; Add a textblock control to display for which menu is clicked (Sub menu 1 or Sub Menu 2).

Add click Event Methods, when the sub menu is clicked (Automatically event method will Generate in MainPage.Xaml.cs). Add the code for Submenuclick Event. Note:Automatically, the code, given below, will be generated in XAML code view, while we are done in the design view.