Skip to content

how to Open DrawerHost outside it ? #2909

Closed Answered by nicolaihenriksen
after1990s asked this question in Q&A
Discussion options

You must be logged in to vote

@after1990s I think what you're trying to accomplish is to activate the drawer from an element located outside of the DrawerHost? For that, you could use the CommandTarget attribute to target the DrawerHost (or any other element inside of it) by its name:

<Button
    Command="{x:Static materialDesign:DrawerHost.OpenDrawerCommand}"
    CommandParameter="{x:Static Dock.Left}"
    CommandTarget="{Binding ElementName=DrawerHost}"
    Content="{materialDesign:PackIcon Kind=ArrowLeft}"/>

<materialDesign:DrawerHost x:Name="DrawerHost">
    <materialDesign:DrawerHost.LeftDrawerContent>
            <Button/>
    </materialDesign:DrawerHost.LeftDrawerContent>
    
    <Button
        x:Name="btn0"

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nicolaihenriksen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants