# Text Column

A `DataGridTextColumn` converts the content of each associated cell to a `System.String` object. The `DataGridTextColumn` provides better performance than a `DataGridTemplateColumn`.

## Key Properties

The Text column provides the `CellContentFormat` key feature, which gets or sets the custom format for each cell value. The Text column uses the `String.Format` routine and the format you pass has to be in the form required by this method.

## Example

The following example shows how to generate a `DataGridTextColumn` manually.

1. First, create the business object.

#### **Create the Data Model**

```C#
public class Data
{
	public string Country { get; set; }
	public string Capital { get; set; }
}
```

1. The next step is to create some sample data.

#### **Create the Sample Data**

```C#
public MainPage()
{
	this.InitializeComponent();		
	this.DataContext = new List<Data>
	{
		new Data { Country = "Columbia", Capital = "Bogota"},
		new Data { Country = "Germany", Capital = "Berlin"},
		new Data { Country = "Italy", Capital = "Rome"},
		new Data { Country = "France", Capital = "Paris" },
		new Data { Country = "Bulgaria", Capital = "Sofia" },
	};
}
```

1. This example shows two columns. As you can see, it uses the `CellContentStyle` property to apply a style to the first column and the `CellContentFormat` property to format the content of the second column. The example also uses the `PropertyName` property to associate each column with the relevant property from the model.

#### **Define in XAML**

```XAML
<telerikGrid:RadDataGrid UserEditMode="Inline" x:Name="grid" AutoGenerateColumns="False" ItemsSource="{Binding}" VerticalAlignment="Center" Width="300">
	<telerikGrid:RadDataGrid.Columns>
		<telerikGrid:DataGridTextColumn PropertyName="Country" Header="Country">
			<telerikGrid:DataGridTextColumn.CellContentStyle>
				<Style TargetType="TextBlock">
					<Setter Property="Foreground" Value="Red"/>
					<Setter Property="FontStyle" Value="Italic"/>
					<Setter Property="HorizontalAlignment" Value="Center"/>
					<Setter Property="VerticalAlignment" Value="Center"/>
				</Style>
			</telerikGrid:DataGridTextColumn.CellContentStyle>
		</telerikGrid:DataGridTextColumn>
		<telerikGrid:DataGridTextColumn PropertyName="Capital" Header="Capital" CellContentFormat="{}{0} city"/>
	</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
```

**Text Column**

![WinUI Text Column Style And Format](https://www.telerik.com/winui/documentation/assets/2668732dd4a4680312eb4fa96db79325/datagrid_textcolumn.png)
