예제 #1
0
		public FeedDataTable ()
		{
			Apps = new ObservableCollection<App> ();

			var dc1 = new DSDataColumn ("ICON");
			dc1.Caption = "";
			dc1.ReadOnly = true;
			dc1.DataType = typeof(UIImage);
			dc1.AllowSort = false;
			dc1.Width = 75.0f;
			dc1.Formatter = new DSImageFormatter (new DSSize (dc1.Width, dc1.Width)) {
				Margin = new DSInset (5.0f),
			};

			this.Columns.Add (dc1);


			// Create a column
			var dc2 = new DSDataColumn ("Name");
			dc2.Caption = "Name";
			dc2.ReadOnly = true;
			dc2.DataType = typeof(String);
			dc2.AllowSort = false;
			dc2.Width = 150;
			this.Columns.Add (dc2);

			// Create a column
			dc2 = new DSDataColumn ("Artist");
			dc2.Caption = "Artist";
			dc2.ReadOnly = true;
			dc2.DataType = typeof(String);
			dc2.AllowSort = false;
			dc2.Width = 200;
			this.Columns.Add (dc2);
		}
		public ExampleDataTable2 (String Name) : base(Name)
		{

			var ColumnsDefs = new Dictionary<String,float>();

			ColumnsDefs.Add("Primary",100);
			ColumnsDefs.Add("Code",150);
			ColumnsDefs.Add("Name",300);
			ColumnsDefs.Add("Phone",174);
			ColumnsDefs.Add("Email",300);

			foreach (var aKey in ColumnsDefs.Keys)
			{
				// Create a column
				var dc1 = new DSDataColumn(aKey);
				dc1.Caption = aKey;
				dc1.ReadOnly = true;
				dc1.DataType = typeof(String);
				dc1.AllowSort = true;
				dc1.Width = ColumnsDefs[aKey];

				this.Columns.Add(dc1);
			}

			for (int loop = 0;loop < 21;loop++)
			{
				var dr = new DSDataRow();
				dr["Primary"] = loop;
				dr["Code"] = @"Customer " + loop.ToString();
				dr["Name"] = @"Name of the Customer " + loop.ToString();
				dr["Phone"] = "01234 56789";
				dr["Email"] = "*****@*****.**";

				this.Rows.Add(dr);
			}



		}
예제 #3
0
		/// <summary>
		/// Initializes a new instance of the <see cref="DSComponentsSample.Data.Grid.ExampleDataTable"/> class.
		/// </summary>
		/// <param name="EntryPoint">Entry point.</param>
		/// <param name="Name">Name.</param>
		public ExampleDataTable (Context EntryPoint, String Name) : base (Name)
		{
			mEntryPoint = EntryPoint;

			var ColumnsDefs = new Dictionary<String,float> ();

			ColumnsDefs.Add ("Image", 30);
			ColumnsDefs.Add ("Ordered", 100);
			ColumnsDefs.Add ("ID", 100);
			ColumnsDefs.Add ("Date", 124);
			//ColumnsDefs.Add ("Title", 150);
			ColumnsDefs.Add ("Description", 550);
			ColumnsDefs.Add ("Value", 100);

			foreach (var aKey in ColumnsDefs.Keys)
			{
				// Create a column
				var dc1 = new DSDataColumn (aKey);

				dc1.Caption = (aKey == "Ordered") ? "Record\nNumber" : aKey;
				dc1.ReadOnly = true;

				if (aKey.Equals ("Image"))
				{
					dc1.DataType = typeof(Bitmap);
					dc1.AllowSort = false;
					dc1.Formatter = new DSImageFormatter (new DSSize (ColumnsDefs [aKey], ColumnsDefs [aKey]));
				}
				else if (aKey.Equals ("Ordered"))
				{
					dc1.DataType = typeof(Boolean);
					dc1.AllowSort = false;

					//					var boolFormatter = new DSBooleanFormatter (DSoft.UI.Grid.Enums.BooleanFormatterStyle.Text, "Yes", "No");
					//					boolFormatter.TextAlignment = DSoft.Datatypes.Enums.TextAlignment.Middle;

					var boolFormatter = new DSBooleanFormatter (BooleanFormatterStyle.Image);
					boolFormatter.Size = new DSSize (10, 10);

					dc1.Formatter = boolFormatter;
				}
				else if (aKey.Equals ("Title"))
				{
					//add a custom view to allow us to update the title
					//DSTextFieldView
					dc1.DataType = typeof(String);
					dc1.AllowSort = true;
					dc1.ReadOnly = false;

					var custFormatter = new DSViewFormatter(new DSTextFieldView(EntryPoint));
					dc1.Formatter = custFormatter;
				}
				else if (aKey.Equals ("Value"))
				{
					dc1.DataType = typeof(String);
					dc1.AllowSort = true;

					//added a text formatter
					dc1.Formatter = new DSTextFormatter (TextAlignment.Left);
				}
				else
				{
					dc1.DataType = typeof(String);
					dc1.AllowSort = true;

				}

				dc1.Width = ColumnsDefs [aKey];

				this.Columns.Add (dc1);
			}

			//add row defs to keep row ids
			for(int loop = 0; loop < 100; loop++)
			{
				var aRow = new DSDataRow ();
				aRow ["Title"] = @"Test";
				aRow ["ID"] = loop;

				Rows.Add (aRow);
			}

		}