Is there a way to see the RenderTreeBuilder version of the razor file in blazor?

Wlbjtsthy

Take the index page for example:

<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

It is my understanding that this will be translated into some code using the RenderTreeBuilder which may look something like this:

builder.OpenElement(0, "h1")
builder.AddContent(1, "Hello, world!")
.
.
.

Is there a place where I can inspect the RenderTreeBuilder version of the razor pages? I would like to start trying out RenderTreeBuilder and would like to know how it is done, for references purposes.

Apologies in advanced if this is a duplicate. I will delete this question if so.

Thanks!

Just the benno

You are right. The BlazorMarkup is translated into C# files that are using the RenderTreeBuilder. It is comparable to what WPF does when it comes to XAML and C# files.

After you have built your project, go to the obj/debug/net5.0/Razor/.

Keep in mind to use a debug build. Otherwise, you won't see the files.

Content of the razor directory

You will see the same directory structure as in your project. Directories are listed as long as they contain razor files. Open the file, e.g., Index.razor.g.cs (.g stands for generated), and you can see the calls to RenderTreeBuilder

 [Microsoft.AspNetCore.Components.RouteAttribute("/")]
    public partial class Index : Microsoft.AspNetCore.Components.ComponentBase
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
            __builder.AddMarkupContent(0, "<h1>Hello, world!</h1>\r\n\r\nWelcome to your new app.\r\n\r\n");
            __builder.OpenComponent<BlazorApp1.Shared.SurveyPrompt>(1);
            __builder.AddAttribute(2, "Title", "How is Blazor working for you?");
            __builder.CloseComponent();
        }
        #pragma warning restore 1998
    }

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Events in Blazor RenderTreeBuilder

分類Dev

Is there a way to see what an executed batch file did?

分類Dev

Blazor Security - Razor Pages custom authentication/security

分類Dev

Blazor / Razor:列挙型のInputSelect?

分類Dev

RenderTreeBuilderバージョンのかみそりファイルをblazorで表示する方法はありますか?

分類Dev

Is there a way to see the body of a lambda in Racket?

分類Dev

Razor 페이지의 Blazor 구성 요소

分類Dev

Razor構文の代わりにRenderTreeBuilderを使用してhtmlを生成する必要があるのはいつですか

分類Dev

Can I see my gem version history?

分類Dev

Best way to preload data in blazor server

分類Dev

How to see all the bits of a file?

分類Dev

Is there an easy way to see what an Elixir macro expands to?

分類Dev

Is there a way to see object names in debug view hierarchy?

分類Dev

Is there a way to see Angular's webpack configuration?

分類Dev

Any way to see HashCode of primitive types?

分類Dev

How to download a file on button click on a Razor page?

分類Dev

RazorページのBlazorコンポーネント

分類Dev

Blazor-Server-Appでcshtml(Razor Pages)を使用する方法

分類Dev

How are Blazor apps able to expose Razor Pages endpoints without a call to MapRazorPages() in Startup.cs?

分類Dev

Blazor(Razor)検証へのクラスの追加

分類Dev

Blazor:Razorファイルで名前空間を定義する

分類Dev

Blazorアプリ/ RazorではIConfigurationは常にNULL.NETCOREです

分類Dev

Blazor / Razorでイベントデータを取得する方法

分類Dev

Get file version in PowerShell

分類Dev

Get file version in PowerShell

分類Dev

Viewing a specific file version

分類Dev

How to see a history of a deleted file/directoty in Perforce?

分類Dev

SCSS file doesn't see imported files

分類Dev

How to see the full file name on the Lubuntu Desktop?

Related 関連記事

  1. 1

    Events in Blazor RenderTreeBuilder

  2. 2

    Is there a way to see what an executed batch file did?

  3. 3

    Blazor Security - Razor Pages custom authentication/security

  4. 4

    Blazor / Razor:列挙型のInputSelect?

  5. 5

    RenderTreeBuilderバージョンのかみそりファイルをblazorで表示する方法はありますか?

  6. 6

    Is there a way to see the body of a lambda in Racket?

  7. 7

    Razor 페이지의 Blazor 구성 요소

  8. 8

    Razor構文の代わりにRenderTreeBuilderを使用してhtmlを生成する必要があるのはいつですか

  9. 9

    Can I see my gem version history?

  10. 10

    Best way to preload data in blazor server

  11. 11

    How to see all the bits of a file?

  12. 12

    Is there an easy way to see what an Elixir macro expands to?

  13. 13

    Is there a way to see object names in debug view hierarchy?

  14. 14

    Is there a way to see Angular's webpack configuration?

  15. 15

    Any way to see HashCode of primitive types?

  16. 16

    How to download a file on button click on a Razor page?

  17. 17

    RazorページのBlazorコンポーネント

  18. 18

    Blazor-Server-Appでcshtml(Razor Pages)を使用する方法

  19. 19

    How are Blazor apps able to expose Razor Pages endpoints without a call to MapRazorPages() in Startup.cs?

  20. 20

    Blazor(Razor)検証へのクラスの追加

  21. 21

    Blazor:Razorファイルで名前空間を定義する

  22. 22

    Blazorアプリ/ RazorではIConfigurationは常にNULL.NETCOREです

  23. 23

    Blazor / Razorでイベントデータを取得する方法

  24. 24

    Get file version in PowerShell

  25. 25

    Get file version in PowerShell

  26. 26

    Viewing a specific file version

  27. 27

    How to see a history of a deleted file/directoty in Perforce?

  28. 28

    SCSS file doesn't see imported files

  29. 29

    How to see the full file name on the Lubuntu Desktop?

ホットタグ

アーカイブ