首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用MaterialDesignThemes DrawerHost

使用MaterialDesignThemes DrawerHost
EN

Stack Overflow用户
提问于 2021-12-29 14:06:44
回答 1查看 308关注 0票数 0

有人能帮我想办法解决这个问题吗?

我在一个名为DashView.xaml的WPF页面上创建了一个菜单,该菜单上有按钮,我想知道如何在单击按钮后使BottomDrawerContent可见。

下面我给出了DashView.xaml中的代码

代码语言:javascript
复制
<materialDesign:DialogHost x:Name="hostSales" >
    <materialDesign:DrawerHost x:Name="SalesDrawerHost" Content="Sales" Foreground="GhostWhite"
                               FontWeight="Bold" FontSize="22" BottomDrawerCloseOnClickAway="True"
                               Cursor="Hand" Width="200" Height="30" ToggleButton.Checked="chkSalesBt1">
    
                        <materialDesign:DrawerHost.BottomDrawerContent x:Uid="dashSalesBt1">
                            <StackPanel x:Name="stkSalesBt1">
                                <Button Content="Record Sales" Foreground="GhostWhite" FontWeight="SemiBold"/>
                                <Button Content="Recent Sales" Foreground="GhostWhite" FontWeight="SemiBold"/>
                            </StackPanel>
                        </materialDesign:DrawerHost.BottomDrawerContent>
                        
    </materialDesign:DrawerHost>
</materialDesign:DialogHost>

我确实有一个叫DashClass.cs的类

只是不知道我要在里面放什么,或者我是如何让执行显示BottomDrawerContent

EN

回答 1

Stack Overflow用户

发布于 2022-04-04 12:32:10

Yout需要一个按钮:

代码语言:javascript
复制
<ToggleButton
    x:Name="menuToggler" 
    Style="{DynamicResource MaterialDesignHamburgerToggleButton}" />`

IsLeftDrawerOpen中使用DrawerHost

代码语言:javascript
复制
<materialDesign:DrawerHost 
    x:Name="SalesDrawerHost" 
    Content="Sales" 
    Foreground="GhostWhite"
    FontWeight="Bold" 
    FontSize="22" 
    BottomDrawerCloseOnClickAway="True"
    Cursor="Hand" 
    Width="200" 
    Height="30"
    IsBottomDrawerOpen="{Binding ElementName=menuToggler, Path=IsChecked}">

    <materialDesign:DrawerHost.BottomDrawerContent x:Uid="dashSalesBt1">
       <StackPanel x:Name="stkSalesBt1">
           <Button Content="Record Sales" Foreground="GhostWhite" FontWeight="SemiBold"/>
           <Button Content="Recent Sales" Foreground="GhostWhite" FontWeight="SemiBold"/>
       </StackPanel>
    </materialDesign:DrawerHost.BottomDrawerContent>
</materialDesign:DrawerHost>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70520516

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档