@using Microsoft.AspNetCore.Components
@using Radzen.Blazor
@inherits LayoutComponentBase
@implements IDisposable
@inject ThemeService ThemeService
@inject QueryStringThemeService QueryStringThemeService
@inject ExampleService ExampleService
@inject NavigationManager UriHelper
@inject IJSRuntime JSRuntime
@inject TooltipService TooltipService
@inject DialogService DialogService
Radzen Blazor Components
@Body
@if (example?.Toc != null)
{
@foreach (var item in example.Toc)
{
}
}
@if (!rendered)
{
}
@code {
RadzenSidebar sidebar0;
RadzenBody body0;
RadzenButton wcagColorsInfo;
RadzenButton rtlInfo;
RadzenButton freeThemesInfo;
RadzenButton premiumThemesInfo;
bool sidebarExpanded = true;
bool configSidebarExpanded = false;
bool rendered;
Example example;
protected override void OnInitialized()
{
UriHelper.LocationChanged += OnLocationChanged;
example = ExampleService.FindCurrent(new Uri(UriHelper.Uri));
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
}
public void Dispose()
{
UriHelper.LocationChanged -= OnLocationChanged;
}
void OnLocationChanged(object sender, LocationChangedEventArgs args)
{
var currentExample = ExampleService.FindCurrent(new Uri(args.Location));
if (currentExample != example)
{
example = currentExample;
StateHasChanged();
}
}
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
rendered = true;
}
}
void ChangeTheme(object value)
{
ThemeService.SetTheme($"{value}");
}
void WcagColorsTooltip(ElementReference elementReference, TooltipOptions options = null) => TooltipService.Open(elementReference, ds =>
@
WCAG Compliant Colors
Enable to preview themes with WCAG 2.2 AA compliant color swatches.
See how to use
, options);
void RtlTooltip(ElementReference elementReference, TooltipOptions options = null) => TooltipService.Open(elementReference, ds =>
@
RTL directionality
Use right to left direction for languages that are written from the right to the left (like Arabic).
, options);
void PremiumThemesTooltip(ElementReference elementReference, TooltipOptions options = null) => TooltipService.Open(elementReference, ds =>
@
Use Premium Themes
Premium themes can be used with an active Radzen Blazor subscription.
See Pricing
Learn more
, options);
void FreeThemesTooltip(ElementReference elementReference, TooltipOptions options = null) => TooltipService.Open(elementReference, ds =>
@
Use Free Themes
These themes are free for commercial use.
Learn more
, options);
async Task ShowVideoDialog(string url)
{
await DialogService.OpenAsync("Create new Blazor app", ds =>
@
, new DialogOptions() {
Width = "50%",
Resizable = true
});
}
internal static RenderFragment RenderTheme(Theme theme, bool showTitle = true)
{
return __builder =>
{
@if (showTitle)
{
@theme.Text
}
};
}
}