Datagrid does not work on mac but works on windows

<?xml version="1.0" encoding="utf-8" ?>

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"

             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

             x:Class="traderDaytraderMaui.NewPage1"

             NavigationPage.HasBackButton="False"

             NavigationPage.HasNavigationBar="False"

             xmlns:sfgrid="clr-namespace:Syncfusion.Maui.DataGrid;assembly=Syncfusion.Maui.DataGrid"

             Background="#44ff00"

             Title="MyTabbedPage">

    <Grid RowDefinitions="40, *">

        <Label Grid.Row = "0" Text="Hellow"></Label>

        <StackLayout Grid.Row="1">


            <sfgrid:SfDataGrid

                                AutoGenerateColumnsMode="None"

                                RowHeight="48"

                                HorizontalScrollBarVisibility="Always"

                                VerticalScrollBarVisibility="Always"

                                ColumnWidthMode="Fill">

                <sfgrid:SfDataGrid.Columns>

                    <sfgrid:DataGridTextColumn MappingName="Wins" HeaderTextAlignment="Center" CellTextAlignment="Center"

                                            HeaderText="W">

                    </sfgrid:DataGridTextColumn>

                    <sfgrid:DataGridTextColumn MappingName="Losses" HeaderTextAlignment="Center" CellTextAlignment="Center"

                                            HeaderText="L">

                    </sfgrid:DataGridTextColumn>


                </sfgrid:SfDataGrid.Columns>

            </sfgrid:SfDataGrid>

        </StackLayout>

    </Grid>


</ContentPage>





public static MauiApp CreateMauiApp()

{

    var builder = MauiApp.CreateBuilder();

    builder

        .UseMauiApp<App>()

        .ConfigureSyncfusionCore()

        .ConfigureFonts(fonts =>

        {

            fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");

            fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");

            fonts.AddFont("Font Awesome 6 Free-Solid-900.otf", "FASolid");

            fonts.AddFont("Font Awesome 6 Free-Regular-400.otf", "FARegular");

            fonts.AddFont("Font Awesome 6 Brands-Regular-400.otf", "FABrandsRegular");

        });


#if DEBUG

    builder.Logging.AddDebug();

#endif


    return builder.Build();

}



This works well on Windows

But not work well on Mac.

When add the sfdatagrid, it is showing only black screen.

When remove the sfdatagrid, it showing the "Hellow"


5 Replies

UM Umesh October 29, 2024 11:49 PM UTC

see attached screenshot and sample codes.


Attachment: image_2024_10_29T23_46_03_544Z_(2)_c0fd2b03.zip


UM Umesh October 30, 2024 12:52 AM UTC

Hello I tried the sample Grid app from your forum also but it works well in windows but when try to run same on mac it gives blank screen. see attached codes and screenshot.


Attachment: SfDataGridSample_(2)_a9d5e271_7ec2418f.zip


SD Sethupathy Devarajan Syncfusion Team October 30, 2024 07:14 AM UTC

Hi Umesh,

The blank issue you are facing on Mac is related to the theme. From the screenshot provided, we identified that you are running the app on Mac with a dark theme. Therefore, the necessary changes need to be added in the App.xaml file. We have shared the code snippet, user guide link, and screenshot for your reference.

Code Snippet:
In App.Xaml,

<?xml version = "1.0" encoding = "UTF-8" ?>

<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"

             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

             xmlns:local="clr-namespace:SfDataGridSample"

             xmlns:syncTheme="clr-namespace:Syncfusion.Maui.Themes;assembly=Syncfusion.Maui.Core"

             x:Class="SfDataGridSample.App" UserAppTheme="Dark">

    <Application.Resources>

        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>

                <syncTheme:SyncfusionThemeResourceDictionary VisualTheme="MaterialDark" />

                <ResourceDictionary Source="Resources/Styles/Colors.xaml" />

                <ResourceDictionary Source="Resources/Styles/Styles.xaml" />

            </ResourceDictionary.MergedDictionaries>

        </ResourceDictionary>

    </Application.Resources>

</Application>


Ug link : Applying themes in Maui Controls


Regards,
Sethupathy D.


Attachment: SfDataGridSample_(2)_a9d5e271_7ec2418f_e675a5d.zip


UM Umesh October 30, 2024 08:35 AM UTC

Thank you for the feedback.



AP Abinesh Palanisamy Syncfusion Team November 1, 2024 06:00 AM UTC

Hi Umesh


Thanks for the update. We'll wait to hear from you. Please test on your end, and let us know if you need any further assistance. We're happy to help.


Regards,

Abinesh P


Loader.
Up arrow icon