How to integrate Grial into an existing .NET MAUI project
-
Make sure that the namespace in Grial Web Admin matches your project's namespace.
-
Add latest UXDivers.GrialMaui nuget package.
-
Set the ApplicationTitle and ApplicationId in the .csproj file that matches the ones defined in Grial Web Admin.
-
Include the GrialLicense file as an EmbeddedResource in the project root.
-
In Android's MainActivity.OnConfigurationChanged method add this line: GrialKit.NotifyConfigurationChanged(newConfig);
-
In Android's MainApplication.CreateMauiApp method add this line: GrialKit.Init("<ROOT_NAMESPACE>.GrialLicense");
-
In iOS's AppDelegate.CreateMauiApp method add this code (using your accent color):
var theme = new ThemeColorsBase(new Dictionary<string, Color> {{ "AccentColor", Color.FromArgb("#FF3F75FF") }});
GrialKit.Init(theme, "`<ROOT_NAMESPACE>`.GrialLicense"); -
Copy the App.xaml styles to your App.xaml.
-
Copy Controls, Helpers, Resx, Themes and Styles folders.
-
Include the reference to the selected Theme in the MergedDictionaries of the App.xaml.
-
Add this line to the App constructor: Resources["DefaultStringResources"] = new Resx.AppResources();
-
Copy Resources/Fonts folder and check that fonts build action is set to MauiFont.
-
Restore packages and run the project.