预览
代码
手机端效果
web端效果
demoTableView.cs
demoTableView.Designer.cs
web:demoTableView.cs
web:demoTableView.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 demoTableView : Smobiler.Core.Controls.MobileForm
{
public demoTableView() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void demoTableView_Load(object sender, EventArgs e)
{
DataTable table = new DataTable();
table.Columns.Add("ID"); //编号
table.Columns.Add("NAME"); //名称
table.Columns.Add("Value"); //数量
table.Rows.Add("1", "图书", "20000");
table.Rows.Add("2", "笔记本", "19500");
table.Rows.Add("3", "硬盘", "19000");
table.Rows.Add("4", "内存", "21000");
if (table.Rows.Count > 0) //绑定数据源
{
tableView1.DataSource = table;
tableView1.DataBind();
}
//
tableView2.DataSource = table;
tableView2.DataBind();
}
private void tableView2_ButtonCellLongPress(object sender, TableViewButtonCellEventArgs e)
{
Toast("当前点击第"+e.Cell.RowIndex+"行,第"+e.Cell.Index+"列,值:"+e.Cell.Text);
}
private void tableView2_ButtonCellPress(object sender, TableViewButtonCellEventArgs e)
{
Toast("当前点击第" + e.Cell.RowIndex + "行,第" + e.Cell.Index + "列,值:" + e.Cell.Text);
}
private void tableView2_CheckBoxCellCheckedChanged(object sender, TableViewCheckBoxCellEventArgs e)
{
Toast("当前checkboox值:"+e.Cell.Checked.ToString());
}
private void tableView2_TextBoxCellTextChanged(object sender, TableViewTextBoxCellEventArgs e)
{
Toast(e.Cell.Text);
}
private void tableView2_TextBoxCellTouchEnter(object sender, TableViewTextBoxCellEventArgs e)
{
Toast("enter");
}
private void tableView2_TextBoxCellTouchLeave(object sender, TableViewTextBoxCellEventArgs e)
{
Toast("leave");
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Components
{
partial class demoTableView : 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()
{
Smobiler.Core.Controls.TableViewLabelColumn tableViewLabelColumn1 = new Smobiler.Core.Controls.TableViewLabelColumn();
Smobiler.Core.Controls.TableViewLabelColumn tableViewLabelColumn2 = new Smobiler.Core.Controls.TableViewLabelColumn();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(demoTableView));
Smobiler.Core.Controls.TableViewCheckBoxColumn tableViewCheckBoxColumn1 = new Smobiler.Core.Controls.TableViewCheckBoxColumn();
Smobiler.Core.Controls.TableViewButtonColumn tableViewButtonColumn1 = new Smobiler.Core.Controls.TableViewButtonColumn();
Smobiler.Core.Controls.TableViewTextBoxColumn tableViewTextBoxColumn1 = new Smobiler.Core.Controls.TableViewTextBoxColumn();
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.tableView1 = new Smobiler.Core.Controls.TableView();
this.label1 = new Smobiler.Core.Controls.Label();
this.tableView2 = new Smobiler.Core.Controls.TableView();
//
// 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 = "TableView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel2});
this.panel1.Flex = 1;
this.panel1.Name = "panel1";
this.panel1.Scrollable = true;
this.panel1.Size = new System.Drawing.Size(0, 100);
//
// 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.tableView1,
this.label1,
this.tableView2});
this.panel2.Location = new System.Drawing.Point(5, 10);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(290, 729);
//
// labContent
//
this.labContent.BackColor = System.Drawing.Color.WhiteSmoke;
this.labContent.FontSize = 15F;
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 = "Columns设置列集合\r\nDataSource设置数据源\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 = "表格控件";
//
// tableView1
//
this.tableView1.Border = new Smobiler.Core.Controls.Border(1F, 1F, 0F, 0F);
this.tableView1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(166)))), ((int)(((byte)(166)))), ((int)(((byte)(166)))));
tableViewLabelColumn1.DataMember = "ID";
tableViewLabelColumn1.DisplayMember = "NAME";
tableViewLabelColumn1.HeaderText = "名称";
tableViewLabelColumn2.DisplayMember = "Value";
tableViewLabelColumn2.HeaderText = "数量";
this.tableView1.Columns.AddRange(new Smobiler.Core.Controls.TableViewColumn[] {
tableViewLabelColumn1,
tableViewLabelColumn2});
this.tableView1.Location = new System.Drawing.Point(90, 97);
this.tableView1.Name = "tableView1";
this.tableView1.Size = new System.Drawing.Size(101, 126);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.WhiteSmoke;
this.label1.FontSize = 15F;
this.label1.Location = new System.Drawing.Point(0, 274);
this.label1.Name = "label1";
this.label1.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label1.Size = new System.Drawing.Size(290, 223);
this.label1.Text = resources.GetString("label1.Text");
this.label1.VerticalAlignment = Smobiler.Core.Controls.VerticalAlignment.Top;
//
// tableView2
//
this.tableView2.Border = new Smobiler.Core.Controls.Border(1F, 1F, 0F, 0F);
this.tableView2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(166)))), ((int)(((byte)(166)))), ((int)(((byte)(166)))));
tableViewButtonColumn1.DisplayMember = "NAME";
tableViewButtonColumn1.HeaderText = "名称";
tableViewTextBoxColumn1.DisplayMember = "Value";
tableViewTextBoxColumn1.HeaderText = "数量";
this.tableView2.Columns.AddRange(new Smobiler.Core.Controls.TableViewColumn[] {
tableViewCheckBoxColumn1,
tableViewButtonColumn1,
tableViewTextBoxColumn1});
this.tableView2.Location = new System.Drawing.Point(70, 524);
this.tableView2.Name = "tableView2";
this.tableView2.Size = new System.Drawing.Size(151, 126);
this.tableView2.TextBoxCellTextChanged += new Smobiler.Core.Controls.TableViewTextBoxCellEventHandler(this.tableView2_TextBoxCellTextChanged);
this.tableView2.TextBoxCellTouchEnter += new Smobiler.Core.Controls.TableViewTextBoxCellEventHandler(this.tableView2_TextBoxCellTouchEnter);
this.tableView2.TextBoxCellTouchLeave += new Smobiler.Core.Controls.TableViewTextBoxCellEventHandler(this.tableView2_TextBoxCellTouchLeave);
this.tableView2.ButtonCellLongPress += new Smobiler.Core.Controls.TableViewButtonCellEventHandler(this.tableView2_ButtonCellLongPress);
this.tableView2.ButtonCellPress += new Smobiler.Core.Controls.TableViewButtonCellEventHandler(this.tableView2_ButtonCellPress);
this.tableView2.CheckBoxCellCheckedChanged += new Smobiler.Core.Controls.TableViewCheckBoxCellEventHandler(this.tableView2_CheckBoxCellCheckedChanged);
//
// demoTableView
//
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel1});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(300, 1500);
this.Load += new System.EventHandler(this.demoTableView_Load);
this.Name = "demoTableView";
}
#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.TableView tableView1;
private Core.Controls.Label label1;
private Core.Controls.TableView tableView2;
}
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace SmobilerTutorialsWeb.Components
{
partial class demoTableView : Smobiler.Core.Controls.MobileForm
{
public demoTableView() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void demoTableView_Load(object sender, EventArgs e)
{
DataTable table = new DataTable();
table.Columns.Add("ID"); //编号
table.Columns.Add("NAME"); //名称
table.Columns.Add("Value"); //数量
table.Rows.Add("1", "图书", "20000");
table.Rows.Add("2", "笔记本", "19500");
table.Rows.Add("3", "硬盘", "19000");
table.Rows.Add("4", "内存", "21000");
if (table.Rows.Count > 0) //绑定数据源
{
tableView1.DataSource = table;
tableView1.DataBind();
}
//
tableView2.DataSource = table;
tableView2.DataBind();
}
private void tableView2_TextBoxCellTextChanged(object sender, TableViewTextBoxCellEventArgs e)
{
Toast(e.Cell.Text);
}
private void tableView2_TextBoxCellTouchEnter(object sender, TableViewTextBoxCellEventArgs e)
{
Toast("enter");
}
private void tableView2_TextBoxCellTouchLeave(object sender, TableViewTextBoxCellEventArgs e)
{
}
private void tableView2_ButtonCellLongPress(object sender, TableViewButtonCellEventArgs e)
{
Toast("当前点击第" + e.Cell.RowIndex + "行,第" + e.Cell.Index + "列,值:" + e.Cell.Text);
}
private void tableView2_ButtonCellPress(object sender, TableViewButtonCellEventArgs e)
{
Toast("当前点击第" + e.Cell.RowIndex + "行,第" + e.Cell.Index + "列,值:" + e.Cell.Text);
}
private void tableView2_CheckBoxCellCheckedChanged(object sender, TableViewCheckBoxCellEventArgs e)
{
Toast("当前checkboox值:" + e.Cell.Checked.ToString());
}
}
}
using System;
using Smobiler.Core;
namespace SmobilerTutorialsWeb.Components
{
partial class demoTableView : 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()
{
Smobiler.Core.Controls.TableViewLabelColumn tableViewLabelColumn1 = new Smobiler.Core.Controls.TableViewLabelColumn();
Smobiler.Core.Controls.TableViewLabelColumn tableViewLabelColumn2 = new Smobiler.Core.Controls.TableViewLabelColumn();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(demoTableView));
Smobiler.Core.Controls.TableViewCheckBoxColumn tableViewCheckBoxColumn1 = new Smobiler.Core.Controls.TableViewCheckBoxColumn();
Smobiler.Core.Controls.TableViewButtonColumn tableViewButtonColumn1 = new Smobiler.Core.Controls.TableViewButtonColumn();
Smobiler.Core.Controls.TableViewTextBoxColumn tableViewTextBoxColumn1 = new Smobiler.Core.Controls.TableViewTextBoxColumn();
this.title1 = new Smobiler.Core.Controls.Title();
this.panel10 = new Smobiler.Core.Controls.Panel();
this.panel1 = new Smobiler.Core.Controls.Panel();
this.labContent = new Smobiler.Core.Controls.Label();
this.tableView1 = new Smobiler.Core.Controls.TableView();
this.label1 = new Smobiler.Core.Controls.Label();
this.tableView2 = new Smobiler.Core.Controls.TableView();
this.labTitle = new Smobiler.Core.Controls.Label();
//
// title1
//
this.title1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(246)))), ((int)(((byte)(246)))));
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(0, 30);
this.title1.Text = "TableView";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// panel10
//
this.panel10.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1,
this.labTitle});
this.panel10.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel10.Flex = 1;
this.panel10.Name = "panel10";
this.panel10.Scrollable = true;
this.panel10.Size = new System.Drawing.Size(0, 970);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Border = new Smobiler.Core.Controls.Border(1F);
this.panel1.BorderColor = System.Drawing.Color.Silver;
this.panel1.BorderRadius = 5;
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.labContent,
this.tableView1,
this.label1,
this.tableView2});
this.panel1.Location = new System.Drawing.Point(300, 57);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(600, 637);
//
// labContent
//
this.labContent.FontSize = 15F;
this.labContent.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.labContent.Location = new System.Drawing.Point(0, 225);
this.labContent.Name = "labContent";
this.labContent.Padding = new Smobiler.Core.Controls.Padding(5F);
this.labContent.Size = new System.Drawing.Size(599, 41);
this.labContent.Text = "Columns设置列集合\r\nDataSource设置数据源\r\n";
this.labContent.VerticalAlignment = Smobiler.Core.Controls.VerticalAlignment.Top;
//
// tableView1
//
tableViewLabelColumn1.DataMember = "ID";
tableViewLabelColumn1.DisplayMember = "NAME";
tableViewLabelColumn1.HeaderText = "名称";
tableViewLabelColumn1.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
tableViewLabelColumn1.Width = 100;
tableViewLabelColumn2.DisplayMember = "Value";
tableViewLabelColumn2.HeaderText = "数量";
tableViewLabelColumn2.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
tableViewLabelColumn2.Width = 100;
this.tableView1.Columns.AddRange(new Smobiler.Core.Controls.TableViewColumn[] {
tableViewLabelColumn1,
tableViewLabelColumn2});
this.tableView1.Location = new System.Drawing.Point(205, 32);
this.tableView1.Name = "tableView1";
this.tableView1.Size = new System.Drawing.Size(200, 165);
//
// label1
//
this.label1.FontSize = 15F;
this.label1.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Center;
this.label1.Location = new System.Drawing.Point(0, 515);
this.label1.Name = "label1";
this.label1.Padding = new Smobiler.Core.Controls.Padding(5F);
this.label1.Size = new System.Drawing.Size(599, 123);
this.label1.Text = resources.GetString("label1.Text");
this.label1.VerticalAlignment = Smobiler.Core.Controls.VerticalAlignment.Top;
//
// tableView2
//
tableViewCheckBoxColumn1.Width = 100;
tableViewButtonColumn1.DisplayMember = "NAME";
tableViewButtonColumn1.HeaderText = "名称";
tableViewButtonColumn1.Width = 100;
tableViewTextBoxColumn1.DisplayMember = "Value";
tableViewTextBoxColumn1.HeaderText = "数量";
tableViewTextBoxColumn1.Width = 100;
this.tableView2.Columns.AddRange(new Smobiler.Core.Controls.TableViewColumn[] {
tableViewCheckBoxColumn1,
tableViewButtonColumn1,
tableViewTextBoxColumn1});
this.tableView2.Location = new System.Drawing.Point(162, 301);
this.tableView2.Name = "tableView2";
this.tableView2.Size = new System.Drawing.Size(300, 179);
this.tableView2.TextBoxCellTextChanged += new Smobiler.Core.Controls.TableViewTextBoxCellEventHandler(this.tableView2_TextBoxCellTextChanged);
this.tableView2.TextBoxCellTouchEnter += new Smobiler.Core.Controls.TableViewTextBoxCellEventHandler(this.tableView2_TextBoxCellTouchEnter);
this.tableView2.TextBoxCellTouchLeave += new Smobiler.Core.Controls.TableViewTextBoxCellEventHandler(this.tableView2_TextBoxCellTouchLeave);
this.tableView2.ButtonCellLongPress += new Smobiler.Core.Controls.TableViewButtonCellEventHandler(this.tableView2_ButtonCellLongPress);
this.tableView2.ButtonCellPress += new Smobiler.Core.Controls.TableViewButtonCellEventHandler(this.tableView2_ButtonCellPress);
this.tableView2.CheckBoxCellCheckedChanged += new Smobiler.Core.Controls.TableViewCheckBoxCellEventHandler(this.tableView2_CheckBoxCellCheckedChanged);
//
// labTitle
//
this.labTitle.BackColor = System.Drawing.Color.White;
this.labTitle.Bold = true;
this.labTitle.Border = new Smobiler.Core.Controls.Border(0F, 0F, 0F, 1F);
this.labTitle.BorderColor = System.Drawing.Color.White;
this.labTitle.FontSize = 16F;
this.labTitle.Location = new System.Drawing.Point(300, 30);
this.labTitle.Name = "labTitle";
this.labTitle.Size = new System.Drawing.Size(600, 26);
this.labTitle.Text = "表格显示控件";
//
// demoTableView
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.panel10});
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Size = new System.Drawing.Size(1200, 800);
this.Load += new System.EventHandler(this.demoTableView_Load);
this.Name = "demoTableView";
}
#endregion
private Smobiler.Core.Controls.Title title1;
private Smobiler.Core.Controls.Panel panel10;
private Smobiler.Core.Controls.Panel panel1;
private Smobiler.Core.Controls.Label labTitle;
private Smobiler.Core.Controls.Label labContent;
private Smobiler.Core.Controls.TableView tableView1;
private Smobiler.Core.Controls.Label label1;
private Smobiler.Core.Controls.TableView tableView2;
}
}