public GetToolTipEventArgs(AsyncToolTip owner, GridCellData d) { Owner = owner; CellData = d; DefaultToolTip = Owner.DefaultToolTip; CurrentToolTip = DefaultToolTip; }
// Use this for initialization void Start() { for (int i = 0; i < height; ++i) { List <GridCellData> l = new List <GridCellData>(); for (int j = 0; j < width; ++j) { GridCellData d = new GridCellData(); if (i == 0 && j == 0) { d.cell = gridRef; } else { GameObject newCell = Instantiate(gridRef, new Vector3(j + 0.01f, 0.0f, i + 0.01f), Quaternion.Euler(90, 0, 0)) as GameObject; newCell.transform.parent = parentRef.transform; d.cell = newCell; } d.mesh = null; l.Add(d); } grid.Add(l); } timeDur = 0.0f; timeRef = 0.0f; touchCount = 0; }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { GridCellData data = (GridCellData)item; var dataItem = data.RowData.Row as TestData; return(dataItem == null || string.IsNullOrEmpty(dataItem.Editor) ? null : (DataTemplate)((FrameworkElement)container).FindResource(dataItem.Editor)); }
void AsyncToolTip_Loaded(object sender, RoutedEventArgs e) { GridCellData d = (GridCellData)DataContext; if (d == null) { return; } GetToolTipEventArgs args; if (!Strings.ContainsKey(d.RowData.Row)) { args = new GetToolTipEventArgs(this, d); Strings.Add(d.RowData.Row, args); Text = DefaultToolTip; } args = Strings[d.RowData.Row]; Text = args.CurrentToolTip; if (GetToolTip != null) { GetToolTip(this, args); } if (GetToolTipCommand != null && GetToolTipCommand.CanExecute(args)) { GetToolTipCommand.Execute(args); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { GridCellData data = (GridCellData)value; int rowHandle = data.RowData.RowHandle.Value; string fieldName = data.Column.FieldName; TableView view = (TableView)data.View; GridSummaryItemCollection summaries = view.Grid.GroupSummary; StringBuilder sb = new StringBuilder(); foreach (GridSummaryItem item in summaries) { if (item.FieldName == fieldName || item.ShowInColumn == fieldName) { if (sb.Length != 0) { sb.Append(Environment.NewLine); } if (string.IsNullOrWhiteSpace(item.DisplayFormat)) { sb.Append(item.SummaryType + " is " + view.Grid.GetGroupSummaryValue(rowHandle, item).ToString()); } else { sb.Append(string.Format(item.DisplayFormat, view.Grid.GetGroupSummaryValue(rowHandle, item).ToString())); } } } return(sb.ToString()); }
private void AssignRandomData(Syncfusion.Windows.Controls.Grid.GridControl grid) { int rows = 35; int cols = 25; grid.Model.RowCount = rows; grid.Model.ColumnCount = cols; Random r = new Random(1231123); GridCellData cellData = grid.Model.Data; for (int i = 1; i < rows; ++i) { GridStyleInfo style = new GridStyleInfo(); style.CellValue = i; cellData[i, 1] = style.Store; style = new GridStyleInfo(); style.CellValue = i; cellData[i, 2] = style.Store; } for (int i = 1; i < rows; ++i) { for (int j = 3; j < cols; ++j) { GridStyleInfo style = new GridStyleInfo(); style.CellValue = r.Next(1000); cellData[i, j] = style.Store; } } }
private GridCellData GetRandomNeighbour(GridCellData cell, GridCellData[,] mazeData) { List <GridCellData> neighbours = new List <GridCellData>(); int maxX = mazeData.GetLength(0) - 1; int maxY = mazeData.GetLength(1) - 1; // Add left neighbour if (cell.x > 0 && !mazeData[cell.x - 1, cell.y].isVisited) { neighbours.Add(mazeData[cell.x - 1, cell.y]); } //Add right neighbour if (cell.x < maxX && !mazeData[cell.x + 1, cell.y].isVisited) { neighbours.Add(mazeData[cell.x + 1, cell.y]); } //Add lower neighbour if (cell.y > 0 && !mazeData[cell.x, cell.y - 1].isVisited) { neighbours.Add(mazeData[cell.x, cell.y - 1]); } // Add upper neighbour if (cell.y < maxY && !mazeData[cell.x, cell.y + 1].isVisited) { neighbours.Add(mazeData[cell.x, cell.y + 1]); } // Returning random neigbor from a list if (neighbours.Count > 0) { return(neighbours[rand.Next(neighbours.Count)]); } // Else return no neighbor return(null); }
public virtual void MouseUp(MouseControllerEventArgs e) { Internalmovdir = MoveDir; BackUpCellValues.Clear(); CellData = new GridCellData(); for (int Row = Gridmodel.SelectedCells.Top; Row <= Gridmodel.SelectedCells.Bottom; Row++) { for (int Column = this.SelectedRange.Left; Column <= this.SelectedRange.Right; Column++) { var CellRowColumnIndex = new RowColumnIndex(Row, Column); GridStyleInfoStore styleinfostore = (GridStyleInfoStore)this.grid.Model[Row, Column].Store.Clone(); //this.CellData[this.grid.Model[Row, Column].CellRowColumnIndex] = styleinfostore; BackUpCellValues.Add(CellRowColumnIndex, styleinfostore);//this.CellData[this.grid.Model[Row, Column].CellRowColumnIndex]); } } this.InnerFillType = SeriesType.FillSeries; this.FillData(); MoveDir = MovingDirection.None; IsMouseDown = false; #if !SILVERLIGHT if (Buttonside == MouseButton.Left) #else if (Buttonside == MouseButtons.Left) #endif { OpenFilterDropDown(); } }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { GridCellData data = (GridCellData)item; GridControl grid = ((GridViewBase)data.View).Grid; string editorType = grid.GetCellValue(data.RowData.RowHandle.Value, "TemplateName") as string; return(string.IsNullOrEmpty(editorType) ? null : (DataTemplate)grid.Resources[editorType]); }
void DestroyProp() { Destroy(grid[(int)cellLooked.y][(int)cellLooked.x].mesh); GridCellData d = new GridCellData(); d.cell = grid[(int)cellLooked.y][(int)cellLooked.x].cell; d.mesh = null; grid[(int)cellLooked.y][(int)cellLooked.x] = d; }
private GridCellData CreateCell(int x, int y, int centerX, int centerY) { GameObject gridCell = Instantiate(gridCellPrefab, new Vector3((x - centerX) * cellWidth, 0f, (y - centerY) * cellWidth), Quaternion.identity); GridCellData cellData = gridCell.GetComponent <GridCellData>(); cellData.x = x; cellData.y = y; cellData.isVisited = false; return(cellData); }
private IList <GridRowData> GetGridRows() { IList <GridRowData> rows = new List <GridRowData>(); // IngredientGrid { GridRowData row = new GridRowData(); rows.Add(row); row.GridId = IngredientGridId; row.Sort = 1; GridCellData cell1 = new GridCellData(); row.Cells.Add(cell1); cell1.GridColumnId = BlockRegister.RecipeIngredientGrid.Col_Sortorder; cell1.ValueText = "1"; GridCellData cell2 = new GridCellData(); row.Cells.Add(cell2); cell2.GridColumnId = BlockRegister.RecipeIngredientGrid.Col_IngredientName; cell2.ValueText = "ingredient.Label"; GridCellData cell3 = new GridCellData(); row.Cells.Add(cell3); cell3.GridColumnId = BlockRegister.RecipeIngredientGrid.Col_Quantity; cell3.ValueText = "2"; GridCellData cell4 = new GridCellData(); row.Cells.Add(cell4); cell4.GridColumnId = BlockRegister.RecipeIngredientGrid.Col_UnitOfMeasure; cell4.ValueText = "ingredient.UnitOfMeasureName"; } // InstructionGrid { GridRowData row = new GridRowData(); rows.Add(row); row.GridId = InstructionGridId; row.Sort = 1; GridCellData cell1 = new GridCellData(); row.Cells.Add(cell1); cell1.GridColumnId = BlockRegister.RecipeInstructionGrid.Col_Sortorder; cell1.ValueText = "1"; GridCellData cell2 = new GridCellData(); row.Cells.Add(cell2); cell2.GridColumnId = BlockRegister.RecipeInstructionGrid.Col_Description; cell2.ValueText = "step.Description"; } return(rows); }
void SpawnProp() { Ray ray = new Ray(this.transform.position, this.transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit) && LookingAtACell() && grid[(int)cellLooked.y][(int)cellLooked.x].mesh == null) { GameObject newProp = Instantiate(propInstantiate, new Vector3(cellLooked.x, 1.0f, cellLooked.y), Quaternion.Euler(0, 180, 0)) as GameObject; GridCellData d = new GridCellData(); d.cell = grid[(int)cellLooked.y][(int)cellLooked.x].cell; d.mesh = newProp; grid[(int)cellLooked.y][(int)cellLooked.x] = d; } }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { GridCellData cellData = item as GridCellData; if (cellData != null) { try { decimal value = Convert.ToDecimal(cellData.Value); if (value >= 500) { return(TotalCellTemplate); } } catch (Exception) { } } return(base.SelectTemplate(item, container)); }
private IEnumerator GenerateMaze(GridCellData[,] mazeData, MazeOptions mazeOptions, GridCellData startingCell) { int maxX = mazeData.GetLength(0) - 1; int maxY = mazeData.GetLength(1) - 1; int startX = startingCell.x; int startY = startingCell.y; List <GridCellData> deadEnds = new List <GridCellData>(); // Stack for recursive generation algorithm Stack <GridCellData> stack = new Stack <GridCellData>(); GridCellData currentCell = startingCell; bool nextCellFound = false; do { currentCell.isVisited = true; // Marking current cell as visited GridCellData nextCell = GetRandomNeighbour(currentCell, mazeData); // Get random neighbor cell as a next one if (nextCell != null) // If there is available next cell, push current cell to stack and assigning next to current { // If there is at least one available neighbor, remove walls between current and next cell RemoveWalls(currentCell, nextCell); stack.Push(currentCell); currentCell = nextCell; nextCellFound = true; } else// Else backtrack to cell that has at least one available neighbor { if (nextCellFound && // If next cell was found in previous iteration but not in this one, this is a dead end (currentCell.x != startX || currentCell.y != startY) // Dont make the starting point also the exit point ) { deadEnds.Add(currentCell); } if (stack.Count > 0) { currentCell = stack.Pop(); } nextCellFound = false; } yield return(null); } while (stack.Count != 0); // Relocate exit point exitCell = deadEnds.Count > 0 ? deadEnds[rand.Next(deadEnds.Count)] : mazeData[maxX, maxY]; exitPoint.transform.position = new Vector3(exitCell.floor.transform.position.x, exitCell.floor.transform.position.y, exitCell.floor.transform.position.z); }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { GridCellData cellData = item as GridCellData; FrameworkElement presenter = container as FrameworkElement; if (cellData != null && presenter != null) { if (cellData.Column.FieldName != "UnitPrice") { return(base.SelectTemplate(item, container)); } if (Convert.ToDouble(cellData.Value) > 20) { return(RowCellTemplate1); } else { return(RowCellTemplate2); } } return(base.SelectTemplate(item, container)); }
private void RemoveWalls(GridCellData currentCell, GridCellData nextCell) { if (currentCell.x < nextCell.x)//goes right { currentCell.walls[GridCellData.Right].SetActive(false); nextCell.walls[GridCellData.Left].SetActive(false); } else if (currentCell.x > nextCell.x)//goes left { currentCell.walls[GridCellData.Left].SetActive(false); nextCell.walls[GridCellData.Right].SetActive(false); } else if (currentCell.y > nextCell.y)//goes down { currentCell.walls[GridCellData.Bottom].SetActive(false); nextCell.walls[GridCellData.Top].SetActive(false); } else if (currentCell.y < nextCell.y)//goes up { currentCell.walls[GridCellData.Top].SetActive(false); nextCell.walls[GridCellData.Bottom].SetActive(false); } }
protected override FrameworkElement CreateChild(object item) { GridCellData cellData = (GridCellData)item; ColumnBase gridColumn = cellData.Column; AutoWidthCellContentPresenter presenter = new AutoWidthCellContentPresenter(); int row = BandedViewBehavior.GetRow(gridColumn); int column = BandedViewBehavior.GetColumn(gridColumn) + 1; int rowSpan = BandedViewBehavior.GetRowSpan(gridColumn); int columnSpan = BandedViewBehavior.GetColumnSpan(gridColumn); StdGrid.SetRow(presenter, row); StdGrid.SetColumn(presenter, column); StdGrid.SetRowSpan(presenter, rowSpan); StdGrid.SetColumnSpan(presenter, columnSpan); if (BandedViewBehavior.GetIsBand(gridColumn)) { presenter.Visibility = Visibility.Collapsed; } else { presenter.Visibility = Visibility.Visible; } return(presenter); }
protected override void SyncWidth(GridCellData cellData) { }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { GridCellData data = (GridCellData)item; return(data.Column.FieldName == "EMail" ? template : null); }
private void Awake() { gridCellData = GetComponentInParent <GridCellData>(); }