protected override object GetCellContentType(GridCellType cellType, GridRow row) { if (cellType != GridCellType.Cell) { return(base.GetCellContentType(cellType, row)); } return(typeof(GridColorColumn)); }
public void Reset () { if (Type == GridCellType.Path) { type = GridCellType.Walkable; } State = GridCellState.NotVisited; Parent = null; H = G = 0; }
/// <summary> /// Resets the cell to initalize state /// </summary> public void Reset() { if (Type == GridCellType.Path) { type = GridCellType.Usable; } State = GridCellState.NotVisited; Parent = null; H = G = 0; }
public override void UnbindCellContent(GridCellType cellType, GridCellRange range, UIView cellContent) { base.UnbindCellContent(cellType, range, cellContent); var label = cellContent as UILabel; if (label != null) { label.TextColor = UIColor.Black; } }
public GridCell(Game game, GridCellType type, Point position, Point screenCoordinates, int width, int height) : base(game) { Type = type; Position = position; ScreenCoordinates = screenCoordinates; Width = width; Height = height; pixel = new Texture2D(game.GraphicsDevice,1,1,1,TextureUsage.None,SurfaceFormat.Color); pixel.SetData(new[] {Color.White}); State = GridCellState.NotVisited; }
public override void UnbindCellContent(GridCellType cellType, GridCellRange range, View cellContent) { base.UnbindCellContent(cellType, range, cellContent); var label = cellContent as Label; if (label != null) { label.TextColor = Color.Default; label.BackgroundColor = Color.Default; } }
protected override View CreateCellContent(GridCellType cellType, object cellContentType) { if (cellType == GridCellType.Cell) { return(new Image()); } else { return(base.CreateCellContent(cellType, cellContentType)); } }
public override void UnbindCellContent(GridCellType cellType, GridCellRange range, FrameworkElement cellContent) { if (cellContent is NodeCell nodeCell) { nodeCell.IsCollapsedChanged -= OnIsCollapsedChanged; } else { base.UnbindCellContent(cellType, range, cellContent); } }
public override void UnbindCellContent(GridCellType cellType, GridCellRange range, View cellContent) { base.UnbindCellContent(cellType, range, cellContent); var label = cellContent as TextView; if (label != null) { label.SetTextColor(Color.Black); label.SetBackgroundColor(Color.Transparent); } }
protected override object GetCellContentType(GridCellType cellType, GridRow row) { if (cellType == GridCellType.Cell) { return(typeof(ImageView)); } else { return(base.GetCellContentType(cellType, row)); } }
protected override View CreateCellContent(GridCellType cellType, object cellContentType, GridRow row) { if (cellType == GridCellType.Cell) { return(new ImageView(Grid.Context)); } else { return(base.CreateCellContent(cellType, cellContentType, row)); } }
//================================================= public GridCell(Game game, GridCellType type, Point position, Point screenCoordinates, int width, int height) : base(game) { Type = type; Position = position; ScreenCoordinates = screenCoordinates; Width = width; Height = height; pixel = new Texture2D(game.GraphicsDevice, 1, 1, true, SurfaceFormat.Color); pixel.SetData(new[] { Color.White }); State = GridCellState.NotVisited; }
public override void UnbindCellContent(GridCellType cellType, GridCellRange range, FrameworkElement cellContent) { base.UnbindCellContent(cellType, range, cellContent); var label = cellContent as TextBlock; if (label != null) { label.Foreground = null; label.Background = null; } }
protected override void BindCellContent(View cellContent, GridCellType cellType, GridRow row) { var dataItem = row.DataItem; var image = cellContent as Image; if (image != null && dataItem != null) { var value = GetCellValue(cellType, row); image.Source = new ImageConverter().Convert(value, typeof(ImageSource), null, CultureInfo.InvariantCulture) as ImageSource; //image.SetBinding(Image.SourceProperty, new Binding(Binding, converter: new ImageConverter(), source: dataItem)); } }
public GridCell(Game game, GridCellType type, Point position, Point screenCoords, int size) : base(game) { Type = type; Position = position; ScreenCoords = screenCoords; Size = size; pixel = new Texture2D(game.GraphicsDevice, 1, 1, true, SurfaceFormat.Color); pixel.SetData(new[] { Color.White }); State = GridCellState.NotVisited; showPath = false; }
public override void PrepareCell(GridCellType cellType, GridCellRange range, GridCellView cell) { base.PrepareCell(cellType, range, cell); if (cellType == GridCellType.Cell && range.Column == 4) { var cellValue = Grid[range.Row, range.Column] as int?; if (cellValue.HasValue) { cell.BackgroundColor = cellValue < 50.0 ? UIColor.FromRGB(0xFF, 0x70, 0x70) : UIColor.FromRGB(0x8E, 0xE9, 0x8E); } } }
public override object GetCellContentType(GridCellType cellType, GridCellRange range) { if (cellType == GridCellType.Cell) { var c = base.Grid.Columns[range.Column]; if (c.Binding == "LastSale" || c.Binding == "Bid" || c.Binding == "Ask") { return(typeof(StockTicker)); } } return(base.GetCellContentType(cellType, range)); }
protected override void BindCellContent(View cellContent, GridCellType cellType, GridRow row) { if (cellType == GridCellType.Cell) { var gauge = cellContent as C1BulletGraph; gauge.Value = (double)GetCellValue(cellType, row); } else { base.BindCellContent(cellContent, cellType, row); } }
public override void PrepareCell(GridCellType cellType, GridCellRange range, GridCellView cell) { base.PrepareCell(cellType, range, cell); if (cellType == GridCellType.Cell && range.Column == 2) { var cellValue = Grid[range.Row, range.Column] as int?; if (cellValue.HasValue) { cell.BackgroundColor = cellValue < 50.0 ? Red : Green; } } }
public override void PrepareCell(GridCellType cellType, GridCellRange range, GridCellView cell, Thickness internalBorders) { base.PrepareCell(cellType, range, cell, internalBorders); var orderCountColumn = Grid.Columns["OrderCount"]; if (cellType == GridCellType.Cell && range.Column == orderCountColumn.Index) { var cellValue = Grid[range.Row, range.Column] as int?; if (cellValue.HasValue) { cell.Background = new SolidColorBrush(cellValue < 50.0 ? Color.FromRgb(0xFF, 0x70, 0x70) : Color.FromRgb(0x8E, 0xE9, 0x8E)); } } }
protected override void BindCellContent(FrameworkElement cellContent, GridCellType cellType, GridRow row) { if (cellType != GridCellType.Cell) { base.BindCellContent(cellContent, cellType, row); return; } var grid = cellContent as Grid; var bitmapIcon = grid.Children[0] as C1BitmapIcon; var textBlock = grid.Children[1] as TextBlock; TrySetBitmapSource(bitmapIcon, cellType, row); textBlock.Text = Grid.GetCellText(cellType, row, this); }
/// <summary> /// Creates the cell. /// </summary> /// <param name="cellType">Type of the cell.</param> /// <param name="range">The range.</param> /// <returns></returns> public override GridCellView CreateCell(GridCellType cellType, GridCellRange range) { var cell = base.CreateCell(cellType, range); if (cellType == GridCellType.Cell && range.Column == 4) { var cellValue = Grid[range.Row, range.Column] as int?; if (cellValue.HasValue) { cell.BackgroundColor = cellValue < 50.0 ? Color.Red : Color.Green; } } return(cell); }
public override void PrepareCell(GridCellType cellType, GridCellRange range, GridCellView cell) { base.PrepareCell(cellType, range, cell); var orderCountColumn = Grid.Columns["OrderCount"]; if (cellType == GridCellType.Cell && range.Column == orderCountColumn.Index) { var cellValue = Grid[range.Row, range.Column] as int?; if (cellValue.HasValue) { cell.BackgroundColor = cellValue < 50.0 ? Color.FromRgb((double)0xFF / 255.0, (double)0x70 / 255.0, (double)0x70 / 255.0) : Color.FromRgb((double)0x8E / 255.0, (double)0xE9 / 255.0, (double)0x8E / 255.0); } } }
public override void PrepareCell(GridCellType cellType, GridCellRange range, GridCellView cell, Thickness internalBorders) { base.PrepareCell(cellType, range, cell, internalBorders); // apply green background if necessary if (cellType == GridCellType.Cell) { var cellValue = Grid[range.Row, range.Column]; if (cellValue is double && (double)cellValue > 500) { cell.Background = _greenBrush; } } }
public override void BindCellContent(GridCellType cellType, GridCellRange range, FrameworkElement cellContent) { var stockTicker = cellContent as StockTicker; if (stockTicker != null) { stockTicker.Tag = Grid.Rows[range.Row].DataItem; stockTicker.BindingSource = Grid.Columns[range.Column].Binding; stockTicker.Value = (double)(decimal)Grid[range.Row, range.Column]; } else { base.BindCellContent(cellType, range, cellContent); } }
protected override void UnbindCellContent(FrameworkElement cellContent, GridCellType cellType, GridRow row) { var grid = cellContent as Grid; var bitmapIcon = grid?.Children?[0] as C1BitmapIcon; if (bitmapIcon != null) { bitmapIcon.Source = null; bitmapIcon.Tag = null; } else { base.UnbindCellContent(cellContent, cellType, row); } }
protected override void UnbindCellContent(View cellContent, GridCellType cellType, GridRow row) { if (cellType == GridCellType.Cell) { CancellationTokenSource cts; if (_cancellationTickets.TryGetValue(row.Index, out cts)) { cts.Cancel(); _cancellationTickets.Remove(row.Index); } } else { base.UnbindCellContent(cellContent, cellType, row); } }
protected override UIView CreateCellContent(GridCellType cellType, object cellContentType, GridRow row) { if (cellType == GridCellType.Cell) { var gauge = new C1BulletGraph(); gauge.Max = 10000; gauge.Target = 7000; gauge.Bad = 1000; gauge.Good = 6000; return(gauge); } else { return(base.CreateCellContent(cellType, cellContentType, row)); } }
protected override View CreateCellContent(GridCellType cellType, object cellContentType, GridRow row) { if (cellType == GridCellType.Cell) { var gauge = new C1BulletGraph(Grid.Context); gauge.IsAnimated = false; gauge.Max = 10000; gauge.Target = 7000; gauge.Bad = 1000; gauge.Good = 6000; gauge.IsReadOnly = true; return(gauge); } else { return(base.CreateCellContent(cellType, cellContentType, row)); } }
public override void PrepareCell(GridCellType cellType, GridCellRange range, GridCellView cell, Thickness internalBorders) { base.PrepareCell(cellType, range, cell, internalBorders); cell.ClearValue(Control.BorderThicknessProperty); if (cellType == GridCellType.Cell) { if (range.Column == 0) { cell.Style = LeftCellStyle ?? CenterCellStyle; } else if (range.Column == Grid.Columns.Count - 1) { cell.Style = RightCellStyle ?? CenterCellStyle; } else { cell.Style = CenterCellStyle; } } }
public override FrameworkElement CreateCellContent(GridCellType cellType, GridCellRange range, object cellContentType) { if (cellContentType as Type == typeof(ArtistCell)) { return(new ArtistCell()); } else if (cellContentType as Type == typeof(AlbumCell)) { return(new AlbumCell()); } else if (cellContentType as Type == typeof(SongCell)) { return(new SongCell()); } else if (cellContentType as Type == typeof(RatingCell)) { return(new RatingCell()); } return(base.CreateCellContent(cellType, range, cellContentType)); }
private bool SwitchCellType(List <NavigationEdge> polygons, GridCellType expectedType, GridCellType resultType) { var maxX = Bounding.B.X - Bounding.A.X; foreach (var polygon in polygons) { var polyStartX = DeterministicFloat.Max(polygon.A.X, Bounding.A.X) - Bounding.A.X; var polyStartY = DeterministicFloat.Max(polygon.A.Y, Bounding.A.Y) - Bounding.A.Y; var polyLenX = DeterministicFloat.Min(polygon.B.X, Bounding.B.X) - Bounding.A.X; var polyLenY = DeterministicFloat.Min(polygon.B.Y, Bounding.B.Y) - Bounding.A.Y; for (DeterministicFloat x = polyStartX; x < polyLenX; x++) { for (DeterministicFloat y = polyStartY; y < polyLenY; y++) { if (Cells[(x + y * maxX).ToInt()].Type != expectedType) { return(false); } } } } foreach (var polygon in polygons) { var polyStartX = DeterministicFloat.Max(polygon.A.X, Bounding.A.X) - Bounding.A.X; var polyStartY = DeterministicFloat.Max(polygon.A.Y, Bounding.A.Y) - Bounding.A.Y; var polyLenX = DeterministicFloat.Min(polygon.B.X, Bounding.B.X) - Bounding.A.X; var polyLenY = DeterministicFloat.Min(polygon.B.Y, Bounding.B.Y) - Bounding.A.Y; for (DeterministicFloat x = polyStartX; x < polyLenX; x++) { for (DeterministicFloat y = polyStartY; y < polyLenY; y++) { Cells[(x + y * maxX).ToInt()].Type = resultType; } } } return(true); }
Color GetColor(GridCellType type) { switch (type) { case GridCellType.Walkable: return Color.Gray; case GridCellType.Unwalkable: return Color.Black; case GridCellType.Source: return Color.Green; case GridCellType.Destination: return Color.Red; case GridCellType.Path: return Color.Yellow; default: return Color.CornflowerBlue; } }
void SetCellType(GridCell cell, GridCellType type) { if (cell == null) { return; } cell.Type = type; }
public GridCellTypeChangedEventArgs(GridCellType oldType, GridCellType newType) { OldType = oldType; NewType = newType; }