Is there a way to open Razor component in Visual Studio with environment with dual screens . I\'ll love to have markup on one screen and @code {}
section on oth
You can use the code behind with a partial class
:
MyComponent.razor
<h1>Thi is a component @Title</h1>
MyComponent.razor.cs
public partial class MyComponent
{
[Parameter]
public string Title { get; set; }
}
This is a 3.1 future, before 3.1 you cannot use
partial class
be inherits from class deriving fromMicrosoft.AspNetCore.Components.ComponenBase
MyComponent.razor
@inherits MyComponentModel
<h1>Thi is a component @Title</h1>
MyComponent.razor.cs
using Microsoft.AspNetCore.Components;
public class MyComponentModel : ComponentBase
{
[Parameter]
public string Title { get; set; }
}