. Net language APP development platform-Smobiler Learning Log: How to quickly implement ContextMenu,. net

Source: Internet
Author: User

. Net language APP development platform-Smobiler Learning Log: How to quickly implement ContextMenu,. net
Smobiler is a development platform that uses the. Net language to develop apps in the VS environment. It may be more convenient than Xamarin.

 

Style 1, Target Style

The following operations are required to achieve the effect:

1. Drag a GridView control and a ContextMenu control from "scycler Components" on the toolbar to the form interface.

2. Modify the property a. load Event code of the GridView control.
VB:    Private Sub TestContextMenu_Load(sender As Object, e As EventArgs)Handles MyBase.Load        Dim matTable As New DataTable        matTable.Columns.Add("MAT_IMG", GetType(String))        matTable.Columns.Add("MAT_DESC1", GetType(String))        matTable.Rows.Add()        matTable.Rows(0)("MAT_IMG") = "log"        matTable.Rows(0)("MAT_DESC1") = "COMS"        matTable.Rows.Add()        matTable.Rows(1)("MAT_IMG") = "logon"        matTable.Rows(1)("MAT_DESC1") = "smobiler"               Me.gridView1.DataSource = matTable        Me.gridView1.DataBind()            End Sub
C#:    private void TestContextMenu_Load(object sender, EventArgs e)    {        DataTable matTable = new DataTable();        matTable.Columns.Add("MAT_IMG", typeof(string));        matTable.Columns.Add("MAT_DESC1", typeof(string));        matTable.Rows.Add();        matTable.Rows[0]["MAT_IMG"] = "log";        matTable.Rows[0]["MAT_DESC1"] = "COMS";        matTable.Rows.Add();        matTable.Rows[1]["MAT_IMG"] = "logon";        matTable.Rows[1]["MAT_DESC1"] = "smobiler";        this.gridView1.DataSource = matTable;        this.gridView1.DataBind();    }
B. CellLongClick Event code
VB:   Private Sub gridView1_CellLongClick(sender As Object, e As GridViewCellEventArgs) Handles gridView1.CellLongClick       contextMenu1.Show()   End Sub
C#:   private void gridView1_CellLongClick(object sender, GridViewCellEventArgs e)   {       contextMenu1.Show();   }

Note: Call the ContextMenu Control

C. Layout attributes

Create a new MobileForm item, name it MessageShow, and drag a Label control and an Image control, 1;

Label1's DataMember attribute (bind the column to be displayed), 2;

The Layout attribute of contextmenu, which is bound to the new form MessageShow1, 3;

Figure 1 Figure 2 Figure 3
3. Modify the properties of the ContextMenu control a. BackColor

Obtains or sets the ContextMenuItem background. The default value is "White" and 1;

B. Items attributes

Open the Set editor, and click "add", ForeColor attribute (Text color), Icon attribute (Icon image resource of Item), Text attribute (Text of Item ), value Attribute (internal Value, not displayed on the Interface), 2. Figure 3;

C. ShowPosition attribute

Set the position of the ContextMenu display. The default value is "LastTouch", indicating that the position is displayed at the last touch;

If you set this attribute to "CenterScreen", it is displayed in the center of the screen.

Figure 1 Figure 2 Figure 3 Figure 4
Ii. Mobile phone effect display

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.