Create your free account

OR Register This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Create your free account

By clicking “Register”, you agree to our
terms of service and privacy policy

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Log in

OR

Reset password

Cshtml5 May 2026

– your C# runs in the browser! 6. CSHTML5 vs OpenSilver vs Blazor | Feature | Legacy CSHTML5 | OpenSilver (modern) | Blazor WebAssembly | |--------|----------------|----------------------|---------------------| | Active | ❌ No | ✅ Yes (MIT) | ✅ Yes | | .NET Version | .NET Framework 4.x | .NET 6,7,8 | .NET 6+ | | Language | C# + XAML | C# + XAML | C# + Razor/HTML | | Runs as | JS + HTML | JS + WebAssembly | WebAssembly | | Best for | Silverline migration | Silverlight/WPF migration | New .NET web apps | | UI Framework | WPF/Silverlight | WPF/Silverlight | Blazor components | Recommendation: If you're starting today , use OpenSilver (not legacy CSHTML5). If you're building a new web app from scratch, consider Blazor instead – but for migrating existing XAML code, OpenSilver is excellent. 7. Sample Output (What the User Sees) When you run the above code, the browser renders:

[____________________] (TextBox) [ Say Hello ] (Button) Hello, World! (TextBlock) cshtml5

ResultText.Text = $"Hello, InputBox.Text!"; – your C# runs in the browser

Right-click → Inspect Element reveals the generated HTML: If you're building a new web app from

You can use this as a . Topic: CSHTML5 – Running C# and XAML in the Browser 1. What is CSHTML5? CSHTML5 (C#/HTML5) is a compiler that translates C# and XAML (typically used with WPF or Silverlight) into HTML5 and JavaScript . This allows developers to build Rich Internet Applications (RIAs) that run inside any modern web browser without plugins. Important Note: The original "CSHTML5" project has evolved. Its modern, actively maintained successor is called OpenSilver (open-source, MIT license). The legacy CSHTML5 is no longer updated, but the concepts remain identical. Key Analogy: Think of it as "XAML for the Web" – like a reverse Blazor (C# to JS instead of WebAssembly). 2. How Does It Work? Instead of rewriting your C# business logic into JavaScript, CSHTML5/OpenSilver does this at compile time:

private void Button_Click(object sender, RoutedEventArgs e)

This website uses cookies. To learn more, visit our Cookie Policy.