Class MazeGrid
The MazeGrid class represents an interactive maze grid
Inheritance
Implements
Inherited Members
Namespace: Maze.Maui.App
Assembly: Maze.Maui.App.dll
Syntax
public class MazeGrid : Grid, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IViewController, IVisualElementController, IElementController, IGestureController, IGestureRecognizers, IPropertyMapperView, IHotReloadableView, IReplaceableView, IBindableLayout, IVisualTreeElement, IGridLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout
Constructors
MazeGrid()
Constructor
Declaration
public MazeGrid()
Properties
FinishCell
Finish cell (if any)
Declaration
public CellFrame? FinishCell { get; }
Property Value
| Type | Description |
|---|---|
| CellFrame | Finish cell |
StartCell
Start cell (if any)
Declaration
public CellFrame? StartCell { get; }
Property Value
| Type | Description |
|---|---|
| CellFrame | Start cell |
Methods
ClearLastSolution()
Clears the last displayed solution
Declaration
public bool ClearLastSolution()
Returns
| Type | Description |
|---|---|
| bool | Boolean |
CreateCellContent(CellFrame, int, int, bool)
Creates the maze cell content for a given location. If the grid is initializing, then cell content is returned that reflects the content of the maze item (if any) - otherwise, an empty cell is returned.
Declaration
public override ContentView CreateCellContent(CellFrame frame, int row, int column, bool gridInitializing)
Parameters
| Type | Name | Description |
|---|---|---|
| CellFrame | frame | Container frame |
| int | row | Row index (zero-based) |
| int | column | Column index (zero-based) |
| bool | gridInitializing | Grid is initializing? |
Returns
| Type | Description |
|---|---|
| ContentView | Maze cell content |
Overrides
DisplaySolution(Solution)
Adds the path associated with the given solution to the display
Declaration
public bool DisplaySolution(Solution solution)
Parameters
| Type | Name | Description |
|---|---|---|
| Solution | solution | Maze solution |
Returns
| Type | Description |
|---|---|
| bool | Boolean |
GetCellContent(int, int)
Gets the maze cell content at a given location
Declaration
public MazeCellContent? GetCellContent(int row, int column)
Parameters
| Type | Name | Description |
|---|---|---|
| int | row | Row index (zero-based) |
| int | column | Column index (zero-based) |
Returns
| Type | Description |
|---|---|
| MazeCellContent | Maze cell content |
GetCellType(int, int)
Gets the maze cell type at a given location
Declaration
public Maze.CellType GetCellType(int row, int column)
Parameters
| Type | Name | Description |
|---|---|---|
| int | row | Row index (zero-based) |
| int | column | Column index (zero-based) |
Returns
| Type | Description |
|---|---|
| Maze.CellType | Maze cell type |
GetCurrentSelectionStatus()
Gets the current selection status
Declaration
public CellStatus GetCurrentSelectionStatus()
Returns
| Type | Description |
|---|---|
| CellStatus | Selection status |
Initialize(bool, MazeItem?)
Initialize
Declaration
public void Initialize(bool enablePanSupport, MazeItem? mazeItem)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enablePanSupport | Enable pan support? |
| MazeItem | mazeItem | Maze item (nullable) |
OnCellDoubleTapped(CellFrame, bool)
Handles the cell double-tapped event
Declaration
public override void OnCellDoubleTapped(CellFrame cellFrame, bool triggerEvents)
Parameters
| Type | Name | Description |
|---|---|---|
| CellFrame | cellFrame | Cell frame |
| bool | triggerEvents | Flag indicating whether to trigger further events |
Overrides
OnCellTapped(CellFrame, bool)
Handles the cell tapped event
Declaration
public override void OnCellTapped(CellFrame cellFrame, bool triggerEvents)
Parameters
| Type | Name | Description |
|---|---|---|
| CellFrame | cellFrame | Cell frame |
| bool | triggerEvents | Flag indicating whether to trigger further events |
Overrides
OnProcessKeyDown(KeyState, Key, bool)
Handles the key down event
Declaration
public override void OnProcessKeyDown(KeyState state, Key key, bool triggerEvents)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyState | state | Key state |
| Key | key | Key pressed |
| bool | triggerEvents | Flag indicating whether to trigger further events |
Overrides
OnSelectionChanged()
Handles the selection changed event
Declaration
public override void OnSelectionChanged()
Overrides
SetSelectionContent(CellType)
Sets the content in the selected cells to the given cell type
Declaration
public void SetSelectionContent(Maze.CellType cellType)
Parameters
| Type | Name | Description |
|---|---|---|
| Maze.CellType | cellType | Cell type |
ToMaze()
Converts the maze grid content to a Maze object
Declaration
public Maze ToMaze()
Returns
| Type | Description |
|---|---|
| Maze | Maze object |
Events
CellDoubleTapped
Registered cell double-tapped event handler
Declaration
public event MazeGrid.CellDoubleTappedEventHandler? CellDoubleTapped
Event Type
| Type | Description |
|---|---|
| MazeGrid.CellDoubleTappedEventHandler | Event handler |
CellTapped
Registered cell tapped event handler
Declaration
public event MazeGrid.CellTappedEventHandler? CellTapped
Event Type
| Type | Description |
|---|---|
| MazeGrid.CellTappedEventHandler | Event handler |
KeyDown
Registered key down event handler
Declaration
public event MazeGrid.ProcessKeyDownEventHandler? KeyDown
Event Type
| Type | Description |
|---|---|
| MazeGrid.ProcessKeyDownEventHandler | Event handler |
SelectionChanged
Registered selection changed event handler
Declaration
public event MazeGrid.SelectionChangedEventHandler? SelectionChanged
Event Type
| Type | Description |
|---|---|
| MazeGrid.SelectionChangedEventHandler | Event handler |