Skip to main content

TextColumnBase.FontFamily Property

Specifies the font name for the text in column’s cells.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

NuGet Package: DevExpress.XamarinForms.Grid

Declaration

[XtraSerializableProperty]
public string FontFamily { get; set; }

Property Value

Type Description
String

The font name.

Remarks

To apply a custom font to the cell text, add the font file to your solution, and then assign it to the grid column’s FontFamily property.

This example shows how to use the Verdana font.

  1. Add the font file to your platform-specific projects:

    • Android
      Add the font file to the Android project’s Assets folder, and set Build Action: AndroidAsset.
    • iOS
      Add the font file to the iOS project’s Resources folder,
      set Build Action: BundleResource,
      and add the font file name to the Info.plist file (the UIAppFonts key in Visual Studio, or the Fonts provided by application property in Visual Studio for Mac).
  2. In the App.xaml file, add the following lines to the ResourceDictionary section:

    <OnPlatform x:TypeArguments="x:String" x:Key="Verdana">
      <On Platform="Android" Value="verdana.ttf#Verdana"/>
      <On Platform="iOS" Value="Verdana"/>
    </OnPlatform>
    
  3. Set the FontFamily property to the key defined for the custom font:

      <dxg:TextColumn FontFamily="{StaticResource Verdana}" />
    

Note

The FontAttributes property affects the default font only. If you need to apply a bold or italic custom font to the text, use the corresponding font style file as described above.

You can also use the BackgroundColor/FontColor properties to configure the background and text color for the column’s cells, and the FontAttributes/FontSize properties to change the font of cells’ text.

To customize the appearance of a specific cell, handle the CustomCellStyle event.

Use the Padding property to set the text padding for a column’s cells.

Example

The following example shows how to customize the appearance of a specific column in the grid:

    <dxg:NumberColumn FontSize="18" 
                      FontColor="Brown" 
                      FontAttributes="Bold" 
                      BackgroundColor="LightGoldenrodYellow" />

See Also