From 2c19fd3ab588f9fbfee5555ab5e57c38aac4700d Mon Sep 17 00:00:00 2001 From: Joseph Herson Thomas Date: Mon, 6 Feb 2023 13:58:50 +0530 Subject: [PATCH 1/2] Add a sample page for adaptive UI with SfMediaQuery --- .../Grid-AdaptiveLayout.csproj | 2 +- .../Grid-AdaptiveLayout/Pages/Counter.razor | 51 ++++++++++++++++--- .../Grid-AdaptiveLayout/Pages/_Layout.cshtml | 4 +- .../Grid-AdaptiveLayout/Shared/NavMenu.razor | 2 +- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Grid-AdaptiveLayout.csproj b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Grid-AdaptiveLayout.csproj index c9b7884..1f5f859 100644 --- a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Grid-AdaptiveLayout.csproj +++ b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Grid-AdaptiveLayout.csproj @@ -8,7 +8,7 @@ - + diff --git a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/Counter.razor b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/Counter.razor index ef23cb3..cbaa2b9 100644 --- a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/Counter.razor +++ b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/Counter.razor @@ -1,18 +1,53 @@ @page "/counter" -Counter +@using Syncfusion.Blazor +@using Syncfusion.Blazor.Grids -

Counter

+
+ + @if (activeBreakpoint == "Small") + { + isAdaptive = true; + } + else + { + isAdaptive = false; + } + + + + + + + + + + -

Current count: @currentCount

- +
@code { - private int currentCount = 0; + public List? Orders { get; set; } + private string? activeBreakpoint { get; set; } + private bool isAdaptive { get; set; } + + protected override void OnInitialized() + { + Orders = Enumerable.Range(1, 75).Select(x => new Order() + { + OrderID = 1000 + x, + CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)], + Freight = 2.1 * x, + OrderDate = DateTime.Now.AddDays(-x), + }).ToList(); + } - private void IncrementCount() + public class Order { - currentCount++; + public int? OrderID { get; set; } + public string? CustomerID { get; set; } + public DateTime? OrderDate { get; set; } + public double? Freight { get; set; } } -} +} \ No newline at end of file diff --git a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/_Layout.cshtml b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/_Layout.cshtml index 0065026..5e5302b 100644 --- a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/_Layout.cshtml +++ b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/_Layout.cshtml @@ -11,8 +11,8 @@ - - + + diff --git a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Shared/NavMenu.razor b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Shared/NavMenu.razor index 445591f..90e1a9c 100644 --- a/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Shared/NavMenu.razor +++ b/Grid-AdaptiveLayout/Grid-AdaptiveLayout/Shared/NavMenu.razor @@ -16,7 +16,7 @@ @code {