简体   繁体   English

带固定工具栏的 MudBlazor 可滚动内容

[英]MudBlazor scrollable content with pinned ToolBar

I want achieve the following result using the MudBlazor library.我想使用 MudBlazor 库实现以下结果。

  1. The (A) element i want to be a MudToolBar with secondary color pinned in the top of the Container (A) 元素我想成为一个 MudToolBar,其次要颜色固定在 Container 的顶部
  2. The (C) element i want it to be a MudToolBar again stuck in the bottom of the Container我希望它成为 MudToolBar 的 (C) 元素再次卡在容器的底部
  3. The (B) element i want it to be a Scrollable container with whatever i put inside. (B) 元素我希望它是一个可滚动的容器,无论我放在里面什么。 When i scroll it, the elements A && C MUST not scroll along with the content.当我滚动它时,元素 A && C 不得随内容滚动。

All of that is diplayed inside a Drawer's main content所有这些都显示在抽屉的主要内容中

<MudMainContent>
        <MudPaper Class="d-flex flex-grow-1 gap-4" Elevation="0">
            <MudLayout>
                // Here i will write the whole component
            </MudLayout>
        </MudPaper>
    </MudMainContent>

Up to now i have done the following到目前为止,我已经完成了以下工作

<div class="d-flex flex-grow-1 flex-row">
    <MudPaper Elevation="25" Class="flex-grow-1">
        <MudToolBar> 
            A-Element
        </MudToolBar>


   <div class="d-flex flex-column" style="max-height:100vh;min-height:100vh; overflow:scroll;">
            // Here there will be a ForEach loop creating elements B-Element
    </div>
    <MudPaper Elevation="25" Class="d-flex flex-row px-2 mx-4" Style="">
         C-Element
    </MudPaper>
    </MudPaper>
</div>

How can i do that??我怎样才能做到这一点??

在此处输入图像描述

Try this:尝试这个:

<div class="d-flex flex-column" style="height:100vh; overflow-x:auto;">
            // Here there will be a ForEach loop creating elements B-Element
</div>

with the same Condition I found this solution useful:在相同的条件下,我发现这个解决方案很有用:

<MudPaper Class="d-flex flex-column overflow-x-auto " Height="100vh">
    Your Content
</MudPaper>

for more information you can read these:有关更多信息,您可以阅读以下内容:

  1. Enable Flexbox in MudBlazor在 MudBlazor 中启用 Flexbox
  2. Flex Direction in MudBlazor MudBlazor 中的弯曲方向
  3. Overflow in MudBlazor MudBlazor 中的溢出

I read this answer and then I wrote my solution based on it.我阅读了这个答案,然后基于它编写了我的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM