预览
代码
手机端效果
demoSectionListView.cs
demoSectionListView.Designer.cs
demoSectionListViewTemplate.cs
demoSectionListViewTemplate.Designer.cs
demoListViewTemplate.cs
demoListViewTemplate.Designer.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Components
{
partial class demoSectionListView : Smobiler.Core.Controls.MobileForm
{
public demoSectionListView() : 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)
{
popList1.ShowDialog();
}
private void demoSectionListView_Load(object sender, EventArgs e)
{
PopListGroup g1 = new PopListGroup();
g1.AddListItem("初始化数量20");
g1.AddListItem("PickerBackColor");
g1.AddListItem("PickerForeColor");
g1.AddListItem("PickerFontSize");
g1.AddListItem("获取第一行TemplateData");
g1.AddListItem("获取第一行TemplateItem");
g1.AddListItem("修改第一行DataSource");
g1.AddListItem("Clear");
g1.AddListItem("Add");
g1.AddListItem("Remove");
g1.AddListItem("初始化数量50");
g1.AddListItem("分隔线");
popList1.Groups.Add(g1);
this.sectionListView1.SectionMember = "Section";
this.sectionListView1.SectionPicker = true;
this.sectionListView1.TemplateControl = new demoListViewTemplate();
this.sectionListView1.SectionControl = new demoSectionListViewTemplate();
}
private void popList1_Selected(object sender, EventArgs e)
{
switch (popList1.Selections[0].Text)
{
case "初始化数量20":
DataTable dt = new DataTable();
dt.Columns.Add("lab");
dt.Columns.Add("Section");
for (int i = 0; i < 20; i++)
{
dt.Rows.Add( "user" + i.ToString(),i);
}
this.sectionListView1.DataSource = dt;
this.sectionListView1.DataBind();
break;
case "PickerBackColor":
this.sectionListView1.PickerBackColor = System.Drawing.Color.White;
break;
case "PickerForeColor":
this.sectionListView1.PickerForeColor = System.Drawing.Color.Yellow;
break;
case "PickerFontSize":
this.sectionListView1.PickerFontSize = 16f;
break;
case "获取第一行TemplateData":
System.Data.DataRowView rowData = this.sectionListView1.Rows[0].Control.TemplateData as System.Data.DataRowView;
if (rowData != null) Toast(rowData.ToString());
break;
case "获取第一行TemplateItem":
SectionListViewRow rowItem = this.sectionListView1.Rows[0].Control.TemplateItem as SectionListViewRow;
if (rowItem != null) Toast(rowItem.ToString());
break;
case "修改第一行DataSource":
break;
case "Clear":
this.sectionListView1.Rows.Clear();
break;
case "Add":
this.sectionListView1.NewRow(this.sectionListView1.Sections[0].SectionID);
break;
case "Remove":
if (this.sectionListView1.Rows.Count > 0)
this.sectionListView1.Rows.RemoveAt(0);
break;
case "初始化数量50":
this.sectionListView1.Rows.Clear();
DataTable dt1 = new DataTable();
dt1.Columns.Add("img");
dt1.Columns.Add("lab");
dt1.Columns.Add("Section");
for (int i = 0; i < 100; i++)
{
dt1.Rows.Add("logon", "test" + i.ToString(),i);
}
this.sectionListView1.DataSource = dt1;
this.sectionListView1.DataBind();
break;
case "分隔线":
this.sectionListView1.ShowSplitLine = true;
this.sectionListView1.SplitLineColor = System.Drawing.Color.Red;
break;
}
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class demoSectionListView : Smobiler.Core.Controls.MobileForm
{
#region "SmobilerForm generated code "
//SmobilerForm overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerForm
//It can be modified using the SmobilerForm.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.panel2 = new Smobiler.Core.Controls.Panel();
this.labContent = new Smobiler.Core.Controls.Label();
this.labTitle = new Smobiler.Core.Controls.Label();
this.button1 = new Smobiler.Core.Controls.Button();
this.sectionListView1 = new Smobiler.Core.Controls.SectionListView();
this.popList1 = new Smobiler.Core.Controls.PopList();
//
// title1
//
this.title1.ImageType = Smobiler.Core.Controls.ImageEx.ImageStyle.FontIcon;
this.title1.Name = "title1";
this.title1.ResourceID = "angle-left";
this.title1.Size = new System.Drawing.Size(300, 30);
this.title1.Text = "SectionListView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel2,
this.sectionListView1});
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 30);
this.panel1.Name = "panel1";
this.panel1.Scrollable = true;
this.panel1.Size = new System.Drawing.Size(310, 470);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Border = new Smobiler.Core.Controls.Border(1F);
this.panel2.BorderColor = System.Drawing.Color.Silver;
this.panel2.BorderRadius = 5;
this.panel2.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.labTitle,
this.button1});
this.panel2.Location = new System.Drawing.Point(5, 9);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(290, 123);
//
// labContent
//
this.labContent.BackColor = System.Drawing.Color.WhiteSmoke;
this.labContent.Location = new System.Drawing.Point(0, 26);
this.labContent.Name = "labContent";
this.labContent.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labContent.Size = new System.Drawing.Size(290, 54);
this.labContent.Text = "可进行数据绑定,添加数据集,删除数据集,清除数据集,设置数据集的操作\r\n";
//
// labTitle
//
this.labTitle.BackColor = System.Drawing.Color.WhiteSmoke;
this.labTitle.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.labTitle.BorderColor = System.Drawing.Color.DarkSeaGreen;
this.labTitle.FontSize = 16F;
this.labTitle.Name = "labTitle";
this.labTitle.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labTitle.Size = new System.Drawing.Size(290, 26);
this.labTitle.Text = "区域列表控件";
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
this.button1.Location = new System.Drawing.Point(39, 87);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(212, 30);
this.button1.Text = "控件介绍";
this.button1.Press += new System.EventHandler(this.button1_Press);
//
// sectionListView1
//
this.sectionListView1.Location = new System.Drawing.Point(5, 135);
this.sectionListView1.Name = "sectionListView1";
this.sectionListView1.PickerFontSize = 8F;
this.sectionListView1.PickerForeColor = System.Drawing.Color.Black;
this.sectionListView1.Size = new System.Drawing.Size(290, 341);
//
// popList1
//
this.popList1.Name = "popList1";
this.popList1.Selected += new System.EventHandler(this.popList1_Selected);
//
// demoSectionListView
//
this.Components.AddRange(new Smobiler.Core.Controls.MobileComponent[] {
this.popList1});
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Load += new System.EventHandler(this.demoSectionListView_Load);
this.Name = "demoSectionListView";
}
#endregion
private Core.Controls.Title title1;
private Core.Controls.Panel panel1;
private Core.Controls.Panel panel2;
private Core.Controls.Label labContent;
private Core.Controls.Label labTitle;
private Core.Controls.Button button1;
private Core.Controls.SectionListView sectionListView1;
private Core.Controls.PopList popList1;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Components
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class demoSectionListViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
public demoSectionListViewTemplate() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
private void button1_Press(object sender, EventArgs e)
{
this.label1.Text = DateTime.Now.ToString();
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class demoSectionListViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.panel1 = new Smobiler.Core.Controls.Panel();
this.label1 = new Smobiler.Core.Controls.Label();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.label1});
this.panel1.Flex = 1;
this.panel1.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(300, 30);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Silver;
this.label1.Bold = true;
this.label1.DisplayMember = "Section";
this.label1.Flex = 1;
this.label1.FontSize = 15F;
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Margin = new Smobiler.Core.Controls.Margin(10F, 0F, 0F, 0F);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(300, 30);
this.label1.Text = "label1";
//
// demoSectionListViewTemplate
//
this.BackColor = System.Drawing.Color.Silver;
this.BorderColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1});
this.Direction = Smobiler.Core.Controls.LayoutDirection.Row;
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(0, 25);
this.Name = "demoSectionListViewTemplate";
}
#endregion
private Core.Controls.Panel panel1;
private Core.Controls.Label label1;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Components
{
////ToolboxItem用于控制是否添加自定义控件到工具箱,true添加,false不添加
//[System.ComponentModel.ToolboxItem(true)]
partial class demoListViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
public demoListViewTemplate() : base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class demoListViewTemplate : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.panel1 = new Smobiler.Core.Controls.Panel();
this.label1 = new Smobiler.Core.Controls.Label();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.label1});
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 30);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.White;
this.label1.DisplayMember = "lab";
this.label1.FontSize = 15F;
this.label1.Margin = new Smobiler.Core.Controls.Margin(10F, 0F, 0F, 0F);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(300, 30);
this.label1.Text = "label1";
//
// demoListViewTemplate
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(0, 25);
this.Name = "demoListViewTemplate";
}
#endregion
private Core.Controls.Panel panel1;
private Core.Controls.Label label1;
}
}