---
id: "P:cAlgo.API.GridLength.UnitType"
kind: "property"
type: "T:cAlgo.API.GridLength"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Grid/GridLength/UnitType/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# GridLength.UnitType

Member of [GridLength](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Grid/GridLength/index.md).

## UnitType

Gets or sets the type of the unit.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public GridUnitType UnitType {get;}
```

Python:

```python
gridLength.UnitType: GridUnitType
```

### Returns

`GridUnitType` — 

### Examples

C#:

```csharp
var grid = new Grid(2, 1);
grid.Rows[0].SetHeightInStars(2);
var height = grid.Rows[0].Height;
if (height.UnitType == GridUnitType.Star)
    Print("Row takes {0} stars", height.Value);
```

Python:

```python
grid = Grid(2, 1)
grid.Rows[0].SetHeightInStars(2)
height = grid.Rows[0].Height
if height.UnitType == GridUnitType.Star:
    api.Print(f"Row takes {height.Value} stars")
```

