Posted 6 March 2023, 9:35 pm EST
Hi,
Thanks for reaching out to us with your query.
Net6 Flegrid Column’s Binding property is type of String(not System.Windows.Data.Binding) where it is not possible to set ConverterCulture. However, you can achieve this requirement by setting CultureInfo.CurrentCulture for the TextBlock under a cell of particular column(DateTime column) using CellFactory.(see code snippet)
public class CustomCellFactory : GridCellFactory
{
public override void BindCellContent(GridCellType cellType, GridCellRange range, FrameworkElement cellContent)
{
base.BindCellContent(cellType, range, cellContent);
if (Grid.Columns[range.Column].ColumnName == "Dispatch" && cellType == GridCellType.Cell)
{
if (cellContent is TextBlock tb)
{
tb.Text = (DateTime.Parse(tb.Text)).ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern, CultureInfo.CurrentCulture);
}
}
}
}
Please refer the attached sample for the same: GridDemo.zip
Best Regards,
Nitin