-
Notifications
You must be signed in to change notification settings - Fork 73
855861: Added subtopics for blazor media query. #3713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7f9dd39
855861: Added subtopics for blazor media query.
VigneshwaranGovindharajan 1ab7611
855861: Updated review concerns for blazor media query.
VigneshwaranGovindharajan b60174d
855861: Updated review concerns for blazor media query.
VigneshwaranGovindharajan 8bb6835
855861: Updated review concerns for blazor media query.
VigneshwaranGovindharajan bfda6b4
855861: Updated review concerns for blazor media query.
VigneshwaranGovindharajan 03e1572
855861: Updated review concerns.
VigneshwaranGovindharajan b29fe30
855861: Updated gif images.
VigneshwaranGovindharajan 9d001f6
855861: compressed gif image size.
VigneshwaranGovindharajan e1279b7
855861: compressed gif image size.
VigneshwaranGovindharajan 5e72434
855861: compressed gif image size.
VigneshwaranGovindharajan 6fb2693
855861: Updated gif images and sample.
VigneshwaranGovindharajan dd49c9f
855861: Updated gif images and sample.
VigneshwaranGovindharajan 97edae1
855861: Re-framed the description.
IndrajithSrinivasan a06f213
855861: Re-framed the description.
IndrajithSrinivasan ad7482c
855861: Updated gif images.
VigneshwaranGovindharajan a921420
855861: Updated gif images.
VigneshwaranGovindharajan 28f349a
855861: Updated review concerns.
VigneshwaranGovindharajan 2707760
855861: Modified Media Query UG
silambarasani d7f499e
855861: Updated review concerns.
VigneshwaranGovindharajan 5118aef
855861: Updated the descriptions
IndrajithSrinivasan 5607c51
855861: Updated integration sample.
VigneshwaranGovindharajan 6a64227
855861: Updated integration sample.
VigneshwaranGovindharajan 49f6514
855861: Updated review concerns.
VigneshwaranGovindharajan 183143c
855861: Updated gif image.
VigneshwaranGovindharajan 667fb34
855861: Updated gif image.
VigneshwaranGovindharajan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| --- | ||
| layout: post | ||
| title: Media Query component Integration with other components | Syncfusion | ||
| description: Checkout and learn here all about how to integrate the Media Query with other component like Chart and much more details. | ||
| platform: Blazor | ||
| control: Media Query | ||
| documentation: ug | ||
| --- | ||
|
|
||
| # Media Query with other components integration | ||
|
|
||
| The Blazor Media Query component enhances the responsiveness of web application, allowing you to perform conditional rendering or styling to achieve a dynamic UI adpatable for various screen sizes. | ||
|
|
||
| In the following code example, showcasing the Data Grid to demonstrate the dynamic updating of adaptive functionalities based on the matched media breakpoint using [ActiveBreakpoint](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfMediaQuery.html#Syncfusion_Blazor_SfMediaQuery_ActiveBreakpoint) property. | ||
|
|
||
| ```cshtml | ||
|
|
||
| @using Syncfusion.Blazor | ||
| @using Syncfusion.Blazor.Grids | ||
|
|
||
| <SfMediaQuery @bind-ActiveBreakPoint="activeBreakpoint"></SfMediaQuery> | ||
|
|
||
| Active media name: <b>@activeBreakpoint</b> | ||
|
|
||
| @{ | ||
| var renderingMode = RowDirection.Horizontal; | ||
| var enableAdaptiveUIMode = false; | ||
| var containerHeight = "100%"; | ||
|
|
||
| if (activeBreakpoint == "Small") | ||
| { | ||
| enableAdaptiveUIMode = true; | ||
| renderingMode = RowDirection.Vertical; | ||
| containerHeight = "600px"; | ||
| } | ||
| else if (activeBreakpoint == "Medium") | ||
| { | ||
| enableAdaptiveUIMode = true; | ||
| } | ||
| else | ||
| { | ||
| enableAdaptiveUIMode = false; | ||
| } | ||
| } | ||
|
|
||
| <div style="position:relative; height: @containerHeight;"> | ||
| <SfGrid DataSource="@orders" EnableAdaptiveUI="@enableAdaptiveUIMode" RowRenderingMode="@renderingMode" AllowSorting="true" AllowFiltering="true" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })" Height="100%" Width="100%"> | ||
| <GridFilterSettings Type="@FilterType.Excel"></GridFilterSettings> | ||
| <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog"></GridEditSettings> | ||
| <GridColumns> | ||
| <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true"></GridColumn> | ||
| <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name"></GridColumn> | ||
| <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date"></GridColumn> | ||
| <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2"></GridColumn> | ||
| </GridColumns> | ||
| </SfGrid> | ||
| </div> | ||
|
|
||
| @code { | ||
| private string activeBreakpoint { get; set; } | ||
| private List<Order> orders { 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(); | ||
| } | ||
|
|
||
| public class Order | ||
| { | ||
| public int? OrderID { get; set; } | ||
| public string CustomerID { get; set; } | ||
| public DateTime? OrderDate { get; set; } | ||
| public double? Freight { get; set; } | ||
| } | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
|  |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| --- | ||
| layout: post | ||
| title: Reuse of Blazor Media Query component | Syncfusion | ||
| description: Checkout and learn here all about how to use the Media Query component at the global level reuse on all pages and much more. | ||
| platform: Blazor | ||
| control: Media Query | ||
| documentation: ug | ||
| --- | ||
|
|
||
| # Global level reuse of Blazor Media Query component | ||
|
|
||
| You can globally reuse the Media Query component in any `razor` pages within web application to achieve a more flexible and responsive layout design. | ||
|
|
||
| Define the Media Query component along with layout `Body` property within the `CascadingValue` component in **MainLayout.razor** page. | ||
|
|
||
| {% tabs %} | ||
| {% highlight razor %} | ||
|
|
||
| @inherits LayoutComponentBase | ||
|
|
||
| <div class="page"> | ||
| <div class="sidebar"> | ||
| <NavMenu /> | ||
| </div> | ||
| <main> | ||
| <div class="top-row px-4"> | ||
| <a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a> | ||
| </div> | ||
| <article class="content px-4"> | ||
| <CascadingValue Value="@activeBreakPoint"> | ||
| <SfMediaQuery @bind-ActiveBreakPoint="activeBreakPoint"></SfMediaQuery> | ||
| @Body | ||
| </CascadingValue> | ||
| </article> | ||
| </main> | ||
| </div> | ||
|
|
||
| @code { | ||
| [Parameter] | ||
| public string activeBreakPoint { get; set; } | ||
| } | ||
|
|
||
| {% endhighlight %} | ||
| {% endtabs %} | ||
|
|
||
| If you are using .NET 8, configure the `@rendermode` in the `<body>` section of the **~/Components/App.razor** file, as shown below: | ||
|
|
||
| ```html | ||
| <body> | ||
| .... | ||
| <Routes @rendermode="InteractiveServer" /> | ||
| </body> | ||
| ``` | ||
|
|
||
| In the below example, the `activeBreakPoint` was accessed in the **Home.razor** and **Counter.razor** files. | ||
|
|
||
| {% tabs %} | ||
| {% highlight C# tabtitle="Home" hl_lines="3 10" %} | ||
|
|
||
| The active breakpoint is @activeBreakPointValue | ||
| <br/><br/> | ||
| <h5>Home Page</h5> | ||
|
|
||
| @code { | ||
| [CascadingParameter] | ||
| public string activeBreakPointValue { get; set; } | ||
| } | ||
| .... | ||
|
|
||
| {% endhighlight %} | ||
| {% highlight C# tabtitle="Counter" hl_lines="3 11" %} | ||
|
|
||
| The active breakpoint is @activeBreakPointValue | ||
| <br /><br /> | ||
| <h5>Counter Page</h5> | ||
|
|
||
| @code { | ||
| [CascadingParameter] | ||
| public string activeBreakPointValue { get; set; } | ||
| } | ||
| .... | ||
|
|
||
| {% endhighlight %} | ||
| {% endtabs %} | ||
|
|
||
|  | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.