.Net语言 APP开发平台——Smobiler学习日志:Poplist控件在APP中的应用场景以及代码

来源:互联网 发布:电池组bms软件下载 编辑:程序博客网 时间:2024/05/25 18:10

最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便

 

一、目标样式

smobiler

我们要实现上图中的效果,需要如下的操作:

1.从工具栏上的”Smobiler Components”拖动一个PopList控件到窗体界面上

smobiler

2.修改PopList控件的属性

a.Groups属性

打开集合编辑器,并点击“添加”,如图1

Text和Value中都输入需要在列表中显示的选项,如图2

在Items中添加数据,如图3

smobilersmobilersmobiler图1图2图3

b.Selections属性

设置默认选项,需要在代码中实现

VB:    Private Sub Button1_Click(senderAs Object, e As EventArgs)Handles Button1.Click        Me.PopList1.Show()        If Label8.Text.Trim().Length <= 0 Then            Me.PopList1.SetSelections(Me.PopList1.Groups(0).Items(6))        End If    End Sub
C#:    private void Button1_Click(object sender, EventArgs e)    {        PopList1.Show();        If (Label8.Text.Trim().Length <= 0)        {            PopList1.SetSelections(PopList1.Groups[0].Items[0]);        }    }

c.MultiSelect属性

默认设置不允许多选

smobiler

d.Selected事件

在内容选择完成后的事件

事件代码:

VB:    Private Sub PopList1_Selected(senderAs Object, e As EventArgs)Handles PopList1.Selected        Me.Label8.Text  = PopList1.Selection.Text    End Sub
C#:    private void PopList1_Selected(object sender, EventArgs e)    {        this.Label8.Text = PopList1.Selection.Text;    }

3.Smobiler窗体设计界面显示效果

smobiler

二、手机效果显示

smobilersmobilersmobiler
0 0
原创粉丝点击