Loading...
Loading...
Compare original and translation side by side
@using Syncfusion.Blazor
<SfMediaQuery @bind-ActiveBreakPoint="currentBreakpoint"></SfMediaQuery>
<h3>Current Breakpoint: @currentBreakpoint</h3>
@if (currentBreakpoint == "Small")
{
<p>You are viewing on a mobile device</p>
}
else if (currentBreakpoint == "Medium")
{
<p>You are viewing on a tablet</p>
}
else
{
<p>You are viewing on a desktop</p>
}
@code {
private string currentBreakpoint { get; set; }
}@using Syncfusion.Blazor
<SfMediaQuery @bind-ActiveBreakPoint="currentBreakpoint"></SfMediaQuery>
<h3>Current Breakpoint: @currentBreakpoint</h3>
@if (currentBreakpoint == "Small")
{
<p>You are viewing on a mobile device</p>
}
else if (currentBreakpoint == "Medium")
{
<p>You are viewing on a tablet</p>
}
else
{
<p>You are viewing on a desktop</p>
}
@code {
private string currentBreakpoint { get; set; }
}Small → Vertical row layout, hide non-essential columns
Medium → Adaptive mode enabled
Large → Horizontal layout, all columns visibleSmall → 垂直行布局,隐藏非必要列
Medium → 启用自适应模式
Large → 水平布局,显示所有列Small → Collapse navigation to hamburger menu
Large → Show full navigation barSmall → 将导航折叠为汉堡菜单
Large → 显示完整导航栏Small → 1-column layout
Medium → 2-column layout
Large → 3-column layoutSmall → 单列布局
Medium → 双列布局
Large → 三列布局MainLayout → Provides activeBreakpoint to all pages
Child Pages → Use CascadingParameter to access breakpoint
Result → Entire app responds to screen size changesMainLayout → 为所有页面提供activeBreakpoint
子页面 → 使用CascadingParameter访问断点
结果 → 整个应用响应屏幕尺寸变化| Property | Type | Description |
|---|---|---|
| string | The currently matching breakpoint name (Small, Medium, Large, or custom) |
| List<MediaBreakpoint> | Custom breakpoints with name and media query string |
| 属性 | 类型 | 描述 |
|---|---|---|
| string | 当前匹配的断点名称(Small、Medium、Large或自定义名称) |
| List<MediaBreakpoint> | 包含名称和媒体查询字符串的自定义断点列表 |
<SfMediaQuery @bind-ActiveBreakPoint="bp"></SfMediaQuery>
@if (bp == "Small")
{
<MobileLayout />
}
else if (bp == "Medium")
{
<TabletLayout />
}
else
{
<DesktopLayout />
}<SfMediaQuery @bind-ActiveBreakPoint="bp"></SfMediaQuery>
@if (bp == "Small")
{
<MobileLayout />
}
else if (bp == "Medium")
{
<TabletLayout />
}
else
{
<DesktopLayout />
}<SfMediaQuery @bind-ActiveBreakPoint="bp"></SfMediaQuery>
@{
var pageSize = bp == "Small" ? 10 : 25;
var allowPaging = bp != "Small";
}
<SfGrid PageSettings="@new GridPageSettings { PageSize = pageSize }">
...
</SfGrid><SfMediaQuery @bind-ActiveBreakPoint="bp"></SfMediaQuery>
@{
var pageSize = bp == "Small" ? 10 : 25;
var allowPaging = bp != "Small";
}
<SfGrid PageSettings="@new GridPageSettings { PageSize = pageSize }">
...
</SfGrid><SfMediaQuery @bind-ActiveBreakPoint="bp"></SfMediaQuery>
@if (bp == "Small")
{
<button @onclick="ToggleMenu">☰ Menu</button>
}
else
{
<nav>Full Navigation Bar</nav>
}<SfMediaQuery @bind-ActiveBreakPoint="bp"></SfMediaQuery>
@if (bp == "Small")
{
<button @onclick="ToggleMenu">☰ Menu</button>
}
else
{
<nav>Full Navigation Bar</nav>
}