Smobiler中Poplist控件的用法
PopList控件用法
一、添加项目
C#:
PopListGroup pg = new PopListGroup() { Title = "浙江",TitleVisible=true };
pg.Items.Add(new PopListItem("嘉兴"));
pg.Items.Add(new PopListItem("杭州"));
pg.Items.Add(new PopListItem("绍兴"));
pg.Items.Add(new PopListItem("金华"));
PopListGroup pg1 =new PopListGroup() { Title = "江苏", TitleVisible = true };
pg1.Items.Add(new PopListItem("南京"));
pg1.Items.Add(new PopListItem("无锡"));
pg1.Items.Add(new PopListItem("徐州"));
pg1.Items.Add(new PopListItem("常州"));
PopListGroup pg2 =new PopListGroup() { Title = "广东", TitleVisible = true };
pg2.Items.Add(new PopListItem("佛山市"));
pg2.Items.Add(new PopListItem("深圳市"));
pg2.Items.Add(new PopListItem("广州市"));
popList1.Groups.AddRange(new PopListGroup[]{ pg, pg1, pg2});
二、显示代码
C#:
popList1.Show(); //全屏显示
//popList1.ShowDialog(); //局部显示
三、获取选中值
3.1,单选
在选择完成事件中用popList1.Selection.Text即可获取。
C#:
private void popList1_Selected(object sender, EventArgs e)
{
string s = popList1.Selection.Text;
}
3.2,多选
在选择完成事件中用popList1.Selections
string strSelItem="";
for (Int16 I = 0; I< popList1.Selections.Count(); I++)
{
strSelItem = strSelItem + popList1.Selections[I].Text.ToString() + ",";
}
if (strSelItem.Length > 0)
{
strSelItem = strSelItem.Substring(0, strSelItem.Length - 1);
}
MessageBox.Show("选择结果:"+ strSelItem, "系统消息");
四、官方示例代码
网址:https://github.com/comsmobiler/SmobilerTutorials/blob/master/Source/Controls/demoPopList.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Controls
{
partial class demoPopList : Smobiler.Core.Controls.MobileForm
{
public demoPopList()
: base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void button1_Press(object sender, EventArgs e)
{
this.popList1.ShowDialog();
}
private void demoPopList_Load(object sender, EventArgs e)
{
PopListGroup g1 = new PopListGroup();
g1.AddListItem("Groups");
g1.AddListItem("Show");
g1.AddListItem("ShowDialog");
g1.AddListItem("Multi-Show");
g1.AddListItem("Multi-ShowDialog");
g1.AddListItem("SingleSelectMode");
g1.AddListItem("Selected事件");
popList1.Groups.Add(g1);
}
private void popList1_Selected(object sender, EventArgs e)
{
switch (popList1.Selections[0].Text)
{
case "Groups":
PopListGroup g1 = new PopListGroup();
g1.TitleVisible = true;
g1.Title = "审批人";
for (int i = 1; i < 3; i++)
{
g1.AddListItem(i.ToString());
}
PopListGroup g2 = new PopListGroup();
g2.Title = "抄送人";
g2.TitleVisible = true;
for (int i = 1; i < 3; i++)
{
g2.AddListItem(i.ToString());
}
PopListItem popItem = new PopListItem();
popItem.Value = "USER_ID";
popItem.Text = "USER_ID";
g2.Items.Add(popItem);
this.popList2.Groups.Add(g1);
this.popList2.Groups.Add(g2);
labContent.Text = "选择组集合数据添加";
break;
case "Show":
this.popList2.MultiSelect = false;
this.popList2.SingleSelectMode = true;
this.popList2.Show();
labContent.Text = "显示列表选择界面";
break;
case "ShowDialog":
this.popList2.MultiSelect = false;
this.popList2.ShowDialog();
labContent.Text = "显示对话框列表选择界面";
break;
case "Multi-Show":
this.popList2.MultiSelect = true;
this.popList2.Show();
labContent.Text = "设置多选来显示列表选择界面";
break;
case "Multi-ShowDialog":
this.popList2.MultiSelect = true;
this.popList2.ShowDialog();
labContent.Text = "设置多选来显示对话框列表选择界面";
break;
case "SingleSelectMode":
this.popList2.MultiSelect = false;
this.popList2.SingleSelectMode = false;
this.popList2.Show();
labContent.Text = "单选时可设置2种不同的选择模式,true时点击结束选择,false时点击完成按钮确认选择";
break;
case "Selected事件":
labContent.Text = "Selected事件在Poplist选择完成时发生。";
break;
}
}
}
}
Smobiler中Poplist控件的用法相关推荐
- wxpython中grid控件一些用法总结
1. 官网主动查找控件的使用方法 wxpython中grid控件的用法可以通过搜索wxpython网址查看使用方法说明.网址:https://docs.wxpython.org/index.html ...
- .net中控件中嵌套控件的用法
最常见的在控件中嵌套控件是,在DataGrid中嵌套一个 CheckBox, 效果是可以知道哪些被选中 for (int i=0; i<DataGrid1.Items.Count;i++) ...
- Windows MObile中ListView控件的用法详解
-前言:ListView在Windows Mobile中的应用非常广泛,也是Windows Mobile中很重要的一个控件,在此俺新手给他做个总结,方便其它新手参考哈! --------------- ...
- winform 窗体中 Time 控件的用法
作用: 用于背景进程中.通过引发Timer事件,Timer控件可以有规律的隔一段时间执行一次代码.也就是,你可以根据你自己的需要,给Timer控件设置时间,Timer每隔这段时间,就执行一次代码. 属 ...
- Silverlight toolkit 中ListPicker控件的用法【转】
ListPicker控件,从外形上看有点像ComboBox,主要的功能也是可以在多个项目中来选择一个项目,如下图,在平常状态下,看到的是跟一般的文字框相同(如图1),而展开后就会出现项目列表(如图2) ...
- Android中ExpandableListView控件的用法详解
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widge ...
- 【转】WPF从我炫系统5---基本控件的用法
今天我来给大家讲解WPF中一些基本控件的用法,所谓基本控件,就是我们最常用用到的一些控件,通过这一节的讲解,大家会对WPF中的控件的用法有一个更深入的了解. 1. 基本控件 LABEL控件 ...
- 【转】WPF从我炫系列3---内容控件的用法
今天我来给大家讲解WPF中内容控件的用法,在WPF中的内容控件,通俗的讲,是指具有Content属性的控件,在content属性里面可以嵌套放置任意其他类型的控件,但是Content只能接受单个元素, ...
- html中radio单选按钮控件标签用法解析及如何设置默认选中
Radio 对象代表 HTML 表单中的单选按钮.在 HTML 表单中 <input type="radio"> 每出现一次,一个 Radio 对象就会被创建.单选按钮 ...
- android include 控件详解,Android开发中include控件用法分析
本文实例讲述了Android开发中include控件用法.分享给大家供大家参考,具体如下: 我们知道,基于Android系统的应用程序的开发,界面设计是非常重要的,它关系着用户体验的好坏.一个好的界面 ...
最新文章
- 计算机录入员考试题及答案,计算机录入员理论考题及答案.docx
- 教你玩转CSS 图像透明/不透明
- Golang package
- b树c语言,B树——思路、及C语言代码的实现
- 免费mac虚拟机下载 快速安装win系统
- java泛型约束_java泛型
- create方法 eslint关闭_详解create-react-app 自定义 eslint 配置
- Base64码常见操作(url链接文件转base64编码、本地文件转base64编码等)
- 零基础搭建美团饿了么外卖红包CPS小程序教程
- lamp一键安装包不安装mysql_LAMP一键安装包-CentOS 5/6下自动编译安装Apache,MySQL,PHP...
- xml与json格式互转
- ElasticJob定时任务学习总结
- qt 截图 视频 截屏幕 截窗口
- TF卡里删掉文件后内存没变大_双11,TF卡,SD卡,读卡器如何选,看这篇就够了...
- 微信设置水滴昵称,个性很漂亮,快试试!
- 2021高考成绩排名查询怎么,2021年高考分数一分一段位次表,高考个人成绩排名查询方法...
- AutoFac基本使用-笔记
- 第一个java程序HelloWorld
- 55家!6G概念、智能交通、智慧政务细分领域龙头全名单!(附市值)
- 黑白棋游戏源代码分析