Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions browser/IgBlazorSamples.Gulp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions samples/grids/grid/grid-theming-overview/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
@using IgniteUI.Blazor.Controls

@inject IJSRuntime JS

<div class="container sample ig-typography @(IsDark ? "container--dark" : "")">
<div class="options horizontal">
<label class="@(IsDark ? "label--dark" : "")">Choose Theme:</label>
<select class="theme-select @(IsDark ? "theme-select--dark" : "")"
value="@SelectedTheme"
@onchange="OnThemeChanged">
@foreach (var theme in Themes)
{
<option value="@theme.Value">@theme.Label</option>
}
</select>
</div>
<div class="container fill">
<IgbGrid
AutoGenerate="false"
Data="NwindData"
PrimaryKey="ProductID"
AllowFiltering="true"
Name="grid"
@ref="grid">
<IgbColumn
Field="ProductID"
Header="Product ID"
Hidden="true">
</IgbColumn>

<IgbColumn
Field="ProductName"
Header="Product Name"
DataType="GridColumnDataType.String"
Sortable="true">
</IgbColumn>

<IgbColumn
Field="UnitPrice"
Header="Unit Price"
DataType="GridColumnDataType.Number"
Sortable="true">
</IgbColumn>

<IgbColumn
Field="QuantityPerUnit"
Header="Quantity Per Unit"
DataType="GridColumnDataType.String"
Sortable="true">
</IgbColumn>

<IgbColumn
Field="ReorderLevel"
Header="Reorder Level"
DataType="GridColumnDataType.Number"
Sortable="true">
</IgbColumn>

<IgbColumn
Field="Discontinued"
Header="Discontinued"
DataType="GridColumnDataType.Boolean"
Sortable="true"
BodyTemplateScript="WebGridBooleanCellTemplate"
Name="column1"
@ref="column1">
</IgbColumn>

<IgbColumn
Field="OrderDate"
Header="Order Date"
DataType="GridColumnDataType.Date"
Sortable="true">
</IgbColumn>
</IgbGrid>
</div>
</div>

@code {

private record ThemeOption(string Value, string Label, string CssPath, bool Dark);

private static readonly ThemeOption[] Themes = new[]
{
new ThemeOption("light-bootstrap", "Bootstrap (Light)", "_content/IgniteUI.Blazor/themes/grid/light/bootstrap.css", false),
new ThemeOption("light-material", "Material (Light)", "_content/IgniteUI.Blazor/themes/grid/light/material.css", false),
new ThemeOption("light-fluent", "Fluent (Light)", "_content/IgniteUI.Blazor/themes/grid/light/fluent.css", false),
new ThemeOption("light-indigo", "Indigo (Light)", "_content/IgniteUI.Blazor/themes/grid/light/indigo.css", false),
new ThemeOption("dark-bootstrap", "Bootstrap (Dark)", "_content/IgniteUI.Blazor/themes/grid/dark/bootstrap.css", true),
new ThemeOption("dark-material", "Material (Dark)", "_content/IgniteUI.Blazor/themes/grid/dark/material.css", true),
new ThemeOption("dark-fluent", "Fluent (Dark)", "_content/IgniteUI.Blazor/themes/grid/dark/fluent.css", true),
new ThemeOption("dark-indigo", "Indigo (Dark)", "_content/IgniteUI.Blazor/themes/grid/dark/indigo.css", true),
};

private string SelectedTheme = "light-bootstrap";
private bool IsDark => Themes.FirstOrDefault(t => t.Value == SelectedTheme)?.Dark ?? false;

private IgbGrid grid;
private IgbColumn column1;

private async Task OnThemeChanged(ChangeEventArgs e)
{
SelectedTheme = e.Value?.ToString() ?? "light-bootstrap";
var theme = Themes.FirstOrDefault(t => t.Value == SelectedTheme);
if (theme != null)
{
await JS.InvokeVoidAsync("eval", $"document.getElementById('grid-theme').href = '{theme.CssPath}'");
}
}

private NwindData _nwindData = null;
public NwindData NwindData
{
get
{
if (_nwindData == null)
{
_nwindData = new NwindData();
}
return _nwindData;
}
}

}
21 changes: 21 additions & 0 deletions samples/grids/grid/grid-theming-overview/BlazorClientApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<AssemblyName>Infragistics.Samples</AssemblyName>
<RootNamespace>Infragistics.Samples</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702,IDE0028,BL0005,0219,CS1998</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IgniteUI.Blazor.Trial" Version="25.2.38" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.1" />
<PackageReference Include="System.Net.Http.Json" Version="10.0.1" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions samples/grids/grid/grid-theming-overview/BlazorClientApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorClientApp", "BlazorClientApp.csproj", "{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC52AAC8-4488-40AE-9621-75F6BA744B18}
EndGlobalSection
EndGlobal
Loading