Back to Blog
January 8, 20267 min readBlazor UI Generation

Blazor UI Generation from .NET MAUI App Recordings

R
Replay Team
Developer Advocates

TL;DR: Replay leverages video recordings of .NET MAUI apps to generate fully functional Blazor UI components, enabling rapid prototyping and cross-platform development.

The holy grail of UI development is writing code once and deploying it everywhere. While .NET MAUI aims for this ideal, sometimes you need a web-based Blazor UI to complement your native app. Manually recreating the UI in Blazor is tedious and error-prone. That's where Replay steps in, bridging the gap by generating Blazor UI directly from .NET MAUI app recordings.

The Problem: Recreating UI Across Platforms#

Developing a consistent user experience across different platforms is a significant challenge. You might have a beautifully designed .NET MAUI app but need a web version. Manually translating that UI to Blazor involves:

  • Re-implementing UI components
  • Replicating styling and layout
  • Rebuilding application logic
  • Ensuring consistent behavior

This process is time-consuming, expensive, and prone to inconsistencies. Screenshot-to-code tools offer a limited solution, only capturing the visual appearance without understanding the underlying behavior.

The Solution: Behavior-Driven Blazor UI Generation with Replay#

Replay offers a revolutionary approach by analyzing video recordings of your .NET MAUI app. Instead of just "seeing" the UI, Replay understands the behavior of the app – button clicks, form submissions, navigation patterns, and more. This "Behavior-Driven Reconstruction" allows Replay to generate a functional Blazor UI that mirrors the behavior of your .NET MAUI app.

How Replay Works: Video-to-Code Magic#

Replay uses Gemini, a powerful video-to-code engine, to analyze your .NET MAUI app recording. The process involves several key steps:

  1. Video Analysis: Replay analyzes the video frame by frame, identifying UI elements, their properties, and user interactions.
  2. Behavior Mapping: It maps user actions (taps, swipes, etc.) to corresponding UI events and state changes.
  3. Code Generation: Based on the analysis, Replay generates Blazor components, including Razor templates, C# code-behind files, and CSS styles.
  4. Supabase Integration (Optional): Replay can automatically integrate with your Supabase backend, setting up data models and API calls to match your .NET MAUI app's data layer.
  5. Style Injection: Replay can inject styles to match the look and feel of your MAUI app.

💡 Pro Tip: For best results, record a clean video with clear interactions and minimal distractions.

Benefits of Using Replay for Blazor UI Generation#

  • Speed: Generate Blazor UI in minutes instead of days.
  • Accuracy: Replay understands behavior, resulting in a more functional and accurate replica.
  • Consistency: Maintain a consistent user experience across platforms.
  • Reduced Development Costs: Save time and resources by automating UI generation.
  • Multi-Page Generation: Replay supports generating multiple Blazor pages based on a single video recording.
  • Product Flow Maps: Visualize the user flow within the generated Blazor application.

Practical Implementation: Generating Blazor UI from a .NET MAUI App Recording#

Let's walk through the process of generating a Blazor UI from a .NET MAUI app recording using Replay.

Step 1: Record Your .NET MAUI App#

Record a video of your .NET MAUI app demonstrating the desired functionality. Focus on showcasing key interactions, navigation, and data input. Keep the recording concise and clear.

📝 Note: Ensure your recording includes all the essential UI elements and interactions you want to replicate in Blazor.

Step 2: Upload to Replay#

Upload the video to Replay. You can either drag and drop the file or select it from your file system.

Step 3: Configure Replay Settings#

Configure the Replay settings based on your requirements. This includes:

  • Project Name: A name for your Blazor project.
  • Output Directory: Where the generated code will be saved.
  • Supabase Integration (Optional): Enable Supabase integration if your .NET MAUI app uses a Supabase backend. Provide your Supabase URL and API key.
  • Styling Options: Customize the styling of the generated Blazor UI.

Step 4: Generate Blazor UI#

Click the "Generate" button. Replay will analyze the video and generate the Blazor UI code. This process may take a few minutes depending on the length of the video and the complexity of the UI.

Step 5: Review and Customize the Generated Code#

Once the generation is complete, review the generated code. You can customize the code to fine-tune the UI, add additional functionality, or integrate with other services.

Here's an example of a generated Blazor component (Razor template):

razor
@page "/todo" <h3>Todo List</h3> <ul> @foreach (var todo in todos) { <li> <input type="checkbox" @bind="todo.IsDone" /> @todo.Title </li> } </ul> <input type="text" @bind="newTodo" /> <button @onclick="AddTodo">Add Todo</button> @code { private List<TodoItem> todos = new List<TodoItem>(); private string newTodo; private void AddTodo() { if (!string.IsNullOrEmpty(newTodo)) { todos.Add(new TodoItem { Title = newTodo }); newTodo = string.Empty; } } private class TodoItem { public string Title { get; set; } public bool IsDone { get; set; } } }

And here's an example of the corresponding C# code-behind file:

csharp
using Microsoft.AspNetCore.Components; namespace BlazorApp.Pages { public partial class Todo { private List<TodoItem> todos = new List<TodoItem>(); private string newTodo; private void AddTodo() { if (!string.IsNullOrEmpty(newTodo)) { todos.Add(new TodoItem { Title = newTodo }); newTodo = string.Empty; } } private class TodoItem { public string Title { get; set; } public bool IsDone { get; set; } } } }

⚠️ Warning: The generated code may require some manual adjustments to perfectly match your .NET MAUI app's UI and behavior.

Comparison with Other Tools#

FeatureScreenshot-to-CodeManual RecreationReplay
Input TypeScreenshotManual CodeVideo
Behavior Analysis✅ (Manual)
Code QualityBasic UIHigh (Manual)Good
Time to ImplementFastSlowMedium
Supabase Integration✅ (Manual)
CostLowHighMedium

Advanced Features and Customization#

Replay offers several advanced features to customize the generated Blazor UI:

  • Custom Code Injection: Inject custom C# code or Razor markup into the generated components.
  • Theme Customization: Apply custom themes to the generated UI.
  • Data Binding Configuration: Configure data binding to match your application's data model.
  • Event Handling Customization: Customize event handling logic.

Real-World Use Cases#

  • Prototyping: Quickly prototype Blazor UIs based on existing .NET MAUI apps.
  • Cross-Platform Development: Easily create web versions of your .NET MAUI apps.
  • UI Migration: Migrate existing .NET MAUI UIs to Blazor.
  • Rapid Iteration: Quickly iterate on UI designs by recording and regenerating.

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free trial and paid plans based on usage. Check the pricing page for details.

How accurate is the generated code?#

The accuracy of the generated code depends on the quality of the video recording and the complexity of the UI. Replay strives for high accuracy, but manual adjustments may be required.

What types of .NET MAUI apps can Replay handle?#

Replay can handle a wide range of .NET MAUI apps, including those with complex UIs, data binding, and event handling.

Can I use Replay with other backend frameworks besides Supabase?#

Yes, you can use Replay with other backend frameworks. However, the automatic Supabase integration is a unique feature. You'll need to manually integrate with other backends.

What output languages are supported?#

Currently Replay focuses on generating Blazor (C#) code. Future versions may include support for other frameworks.


Ready to try behavior-driven code generation? Get started with Replay - transform any video into working code in seconds.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free