示例#1
0
文件: GridView.cs 项目: Exe0/Eto
		public GridViewCellArgs(GridColumn gridColumn, int row, int column, object item)
		{
			this.GridColumn = gridColumn;
			this.Row = row;
			this.Column = column;
			this.Item = item;
		}
示例#2
0
		GridView CreateGrid()
		{
			var control = new GridView
			{
				Size = new Size(300, 100)
			};
			LogEvents(control);

			var dropDown = MyDropDown("DropDownKey");
			control.Columns.Add(new GridColumn { DataCell = new CheckBoxCell("Check"), AutoSize = true, Resizable = false });
			control.Columns.Add(new GridColumn { HeaderText = "Image", DataCell = new ImageViewCell("Image"), Resizable = false });
			control.Columns.Add(new GridColumn { HeaderText = "ImageText", DataCell = new ImageTextCell("Image", "Text") });
			control.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Text"), Sortable = true });
			control.Columns.Add(new GridColumn { HeaderText = "Progress", DataCell = new ProgressCell("Progress") });
			control.Columns.Add(new GridColumn { HeaderText = "Drop Down", DataCell = dropDown, Sortable = true });
			if (Platform.Supports<CustomCell>())
			{
				//control.ReloadSelectedCells = true;
				//control.SelectedRowsChanged += (sender, e) => control.ReloadData(control.SelectedRows);
				var col = new GridColumn { HeaderText = "Custom", Sortable = true, DataCell = new MyCustomCell() };
				control.Columns.Add(col);
			}

			if (Platform.Supports<DrawableCell>())
			{
				var drawableCell = new DrawableCell();
				drawableCell.Paint += (sender, e) =>
				{
					var m = e.Item as MyGridItem;
					if (m != null)
					{
						if (e.CellState.HasFlag(CellStates.Selected))
							e.Graphics.FillRectangle(Colors.Blue, e.ClipRectangle);
						else
							e.Graphics.FillRectangle(Brushes.Cached(m.Color), e.ClipRectangle);
						var rect = e.ClipRectangle;
						rect.Inflate(-5, -5);

						var color = e.CellState.HasFlag(CellStates.Editing) ? Colors.Black : Colors.White;
						e.Graphics.DrawRectangle(color, rect);
						e.Graphics.DrawLine(color, rect.Left, rect.Bottom, rect.MiddleX, rect.Top);
						e.Graphics.DrawLine(color, rect.Right, rect.Bottom, rect.MiddleX, rect.Top);
					}
				};
				control.Columns.Add(new GridColumn
				{
					HeaderText = "Owner drawn",
					DataCell = drawableCell
				});
			}

			return control;
		}
示例#3
0
文件: Grid.cs 项目: majorsilence/Eto
		public GridColumnEventArgs (GridColumn column)
		{
			this.Column = column;
		}
示例#4
0
文件: Grid.cs 项目: majorsilence/Eto
		public GridCellFormatEventArgs (GridColumn column, object item, int row)
		{
			this.Column = column;
			this.Item = item;
			this.Row = row;
		}
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.GridColumnEventArgs"/> class.
 /// </summary>
 /// <param name="column">Column that originated the event</param>
 public GridColumnEventArgs(GridColumn column)
 {
     this.Column = column;
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.GridCellFormatEventArgs"/> class.
 /// </summary>
 /// <param name="column">Column to format</param>
 /// <param name="item">Item for the row being formatted</param>
 /// <param name="row">Row number being formatted</param>
 protected GridCellFormatEventArgs(GridColumn column, object item, int row)
 {
     Column = column;
     Item   = item;
     Row    = row;
 }
示例#7
0
文件: Grid.cs 项目: daddycoding/Eto
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.GridCellFormatEventArgs"/> class.
 /// </summary>
 /// <param name="column">Column to format</param>
 /// <param name="item">Item for the row being formatted</param>
 /// <param name="row">Row number being formatted</param>
 protected GridCellFormatEventArgs(GridColumn column, object item, int row)
 {
     this.Column = column;
     this.Item   = item;
     this.Row    = row;
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.GridViewCellEventArgs"/> class.
 /// </summary>
 /// <param name="gridColumn">Grid column that triggered the event.</param>
 /// <param name="row">The row that triggered the event, or -1 if no row.</param>
 /// <param name="column">Column that triggered the event, or -1 if no column.</param>
 /// <param name="item">Item of the row that triggered the event, or null if no item.</param>
 public GridViewCellEventArgs(GridColumn gridColumn, int row, int column, object item)
     : base(gridColumn, row, column, item)
 {
 }
示例#9
0
		public PropertyCellSection()
		{
			var infoColumn = new GridColumn
			{
				HeaderText = "Name",
				Editable = false,
				DataCell = new TextBoxCell { Binding = Binding.Property((MyModel m) => m.Name) }
			};
			var valueProperty = Binding.Property((MyModel m) => m.Value);

			var propertyCell = new PropertyCell
			{ 
				TypeBinding = Binding.Property((MyModel m) => (object)m.Type),
				Types =
				{
					new PropertyCellTypeBoolean { ItemBinding = valueProperty.OfType<bool?>() },
					new PropertyCellTypeString { ItemBinding = valueProperty.OfType<string>() },
					new PropertyCellTypeColor { ItemBinding = valueProperty.OfType<Color>() },
					new PropertyCellTypeDateTime { ItemBinding = valueProperty.OfType<DateTime?>() },
					new PropertyCellTypeEnum<Orientation> { ItemBinding = valueProperty.OfType<Orientation>() }
				}
			};

			var filtered = new FilterCollection<MyModel>(new []
			{
				new MyModel { Name = "Bool Property (checked)", Type = typeof(bool?), Value = true },
				new MyModel { Name = "Bool Property", Type = typeof(bool), Value = false },
				new MyModel { Name = "String Property", Type = typeof(string), Value = "hello" },
				new MyModel { Name = "Color Property", Type = typeof(Color), Value = Colors.Blue },
				new MyModel { Name = "DateTime Property", Type = typeof(DateTime), Value = DateTime.Today },
				new MyModel { Name = "Enum Property", Type = typeof(Orientation), Value = Orientation.Vertical }
			});

			var valueColumn = new GridColumn
			{
				AutoSize = true,
				Editable = true,
				HeaderText = "Value",
				DataCell = propertyCell,
			};

			var grid = new GridView
			{
				Columns = { infoColumn, valueColumn }
			};


			grid.DataStore = filtered;


			var searchBox = new SearchBox();
			searchBox.TextChanged += (sender, e) => filtered.Filter = m => m.Name.IndexOf(searchBox.Text, StringComparison.OrdinalIgnoreCase) >= 0;

			Content = new StackLayout
			{
				HorizontalContentAlignment = HorizontalAlignment.Stretch,
				Spacing = 5,
				Padding = 10,
				Items =
				{
					searchBox,
					new StackLayoutItem(grid, expand: true)
				}
			};
		}