...
/Solution: Adding Razor Components to the Homepage
Solution: Adding Razor Components to the Homepage
Review the solution to adding Razor components to the homepage of a Blazor MAUI app.
We'll cover the following...
The completed solution is presented in the code playground below:
<?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:MauiBlazorApp" x:Class="MauiBlazorApp.App"> <Application.Resources> <ResourceDictionary> <Color x:Key="PageBackgroundColor">#512bdf</Color> <Color x:Key="PrimaryTextColor">White</Color> <Style TargetType="Label"> <Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" /> <Setter Property="FontFamily" Value="OpenSansRegular" /> </Style> <Style TargetType="Button"> <Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" /> <Setter Property="FontFamily" Value="OpenSansRegular" /> <Setter Property="BackgroundColor" Value="#2b0b98" /> <Setter Property="Padding" Value="14,10" /> </Style> </ResourceDictionary> </Application.Resources> </Application>
Complete solution with a Counter Razor component on the homepage
Solving the challenge
Below are the descriptions of how each task can be solved. ...