DataGridTemplateColumn Error

  1. The DataGridTemplateColumn is not showing in headers
  2. Binding to a Progressbar inside the DataGridTemplateColumn leads to:
          the input string is in the wrong format

            <syncfusiondatagrid:SfDataGrid ItemsSource="{Binding Reminders}" SelectedRow="{Binding Selected}" AutoGenerateColumnsMode="None" AllowEditing="False"

                               AllowDeleting="False" AllowDraggingColumn="False" ColumnWidthMode="Fill" BackgroundColor="White">

                <syncfusiondatagrid:SfDataGrid.Columns>

                    <syncfusiondatagrid:DataGridTextColumn HeaderText="{DynamicResource name}" DisplayBinding="{Binding Name}"/>

                    <syncfusiondatagrid:DataGridTextColumn HeaderText="{DynamicResource started}" DisplayBinding="{Binding Started}"/>

                    <syncfusiondatagrid:DataGridTextColumn HeaderText="{DynamicResource appointment}" DisplayBinding="{Binding Appointment}"/>

                    <syncfusiondatagrid:DataGridTemplateColumn HeaderText="{DynamicResource remaining}" AllowEditing="False">

                        <syncfusiondatagrid:DataGridTemplateColumn.CellTemplate>

                            <DataTemplate x:DataType="{x:Type vm:ReminderViewModel}">

                                <syncprogressbar:SfLinearProgressBar />

                                <!--Progress="{Binding Progress, Mode=OneWay}" Maximum="1" Minimum="0" Background="Transparent"

                                                                 ProgressFill="{Binding Expired, Converter={StaticResource reminderprogressconverter}}"-->

                            </DataTemplate>

                        </syncfusiondatagrid:DataGridTemplateColumn.CellTemplate>

                    </syncfusiondatagrid:DataGridTemplateColumn>

                </syncfusiondatagrid:SfDataGrid.Columns>


            </syncfusiondatagrid:SfDataGrid>



3 Replies

SD Sethupathy Devarajan Syncfusion Team June 27, 2024 02:20 PM UTC

Hi Klausa,


Thank you for reaching out to us.


Query

Response

    1. The DataGridTemplateColumn is not showing in headers

Based on the code snippet provided. It is clear that you are setting headerText as Dynamic resource. Syncfusion Maui dataGrid do not have dynamic resource support. To fix this, you should set the HeaderText directly as a string without using dynamic resources or you can define the mapping name property.

 

 

If you need to load template in header. Kindly use header template.

UG Link -  https://help.syncfusion.com/maui/datagrid/column-types#header-template.

    1. Binding to a Progressbar inside the DataGridTemplateColumn leads to:

              the input string is in the wrong format

Based on the code snippet provided , we created a simple sample and checked your query. However we are unable to replicate the Issue. We had attached a simple sample for your reference.


Regards,

Sethupathy D.


Attachment: SfDataGridSample_bbd2d13a.zip


KA Klaus Aman June 28, 2024 05:45 PM UTC

sorry for confusion, i mean the text of the header is not vissible while other are...

to 2. im using your datagrid in a datatemplate inside of a resourcesdictionary

the dynamicresource is workting on the DataGridTextColumn why not on DataGrindTemplateColumn


i need it for different languages :(

yea i have other issues like 2. so its not your fault

Image_9882_1719596096465



SD Sethupathy Devarajan Syncfusion Team July 1, 2024 12:45 PM UTC

Hi Klaus,

Query

Response

1. text of the header is not visible while other are...

 

As mentioned in our previous response, Syncfusion MAUI DataGrid does not support dynamic resource binding. You have defined the Display Binding property for the Text Column but not for the Template Column. The header text is visible for the Text Column due to the Display Binding property in your code snippet.

We would like to inform you that the header text is displayed using the path value of the display binding property in your sample, not by the header text property. If you don't set the mapping name, the path of the display binding will be considered the mapping name. Therefore, the display binding's path will be set as the header text.

To display the header for the template column, you can simply set the HeaderText property directly as a string without using dynamic resources or you can define the MappingName property in the Template Column

 

 

If you need to load a template in the header, please use the HeaderTemplate.

https://help.syncfusion.com/maui/datagrid/column-types#header-template.

 

2. i need it for different languages :(

You can perform translation of header text by the following steps;

1.Create a new folder named Helper in your sample.

2.Add TranslateExtention.cs file in the Helper folder.

3.Inside the Resources folder Add -> AppResouce.resx and AppResource.fr-FR.resx files.

4.In App.Xaml.cs file include 

       public App()

       {

           InitializeComponent();

           CultureInfo culture = new CultureInfo("fr-FR");

           Thread.CurrentThread.CurrentCulture = culture;

           MainPage = new AppShell();

       }

 

5.In MainPage.Xaml define :

HeaderText="{res:Translate name}"

 

We have attached a simple sample and a screenshot for your reference. In our sample, we have demonstrated the translation of header text from English to French.

Regards,

Sethupathy D.



Attachment: SfDataGridSample_(2)_1a910727.zip

Loader.
Up arrow icon