1
1
1SLY22020-06-06 22:20:50
C++ / C#
1SLY2, 2020-06-06 22:20:50

Hamburger menu not opening?

Hello, I am trying to implement gamb. menus don't break MVVM rules.
Here is the menu XAML code:

<Button  x:Name="HamburgerButton" 
                    RelativePanel.AlignLeftWithPanel="True"
                    FontFamily="Segoe MDL2 Assets" 
                    FontSize="36"
                    Content="&#xE700;"
                    Command="{Binding PaneOpenCommand}"/>

            <TextBlock Name="TitleTextBlock" 
                       RelativePanel.RightOf="HamburgerButton"
                       FontSize="28" 
                       FontWeight="Bold" 
                       Margin="30 5 0 0" />

            <SplitView Name="mySplitView" Grid.Row="1" OpenPaneLength="200" IsPaneOpen="{Binding IsPaneOpened}">
                <SplitView.Pane>
                    <ListBox SelectionMode="Single" >
                        <ListBoxItem Name="home">
                            <TextBlock FontSize="24" Text="Главная" />
                        </ListBoxItem>
                        <ListBoxItem Name="share">
                            <TextBlock FontSize="24" Text="Поделиться" />
                        </ListBoxItem>
                        <ListBoxItem Name="settings">
                            <TextBlock FontSize="24" Text="Настройки" />
                        </ListBoxItem>
                    </ListBox>
                </SplitView.Pane>
            </SplitView>

The bottom line is, there is a Boolean variable that is responsible for opening, and a command that changes the value of the variable:
private bool isPaneOpened;
        public bool IsPaneOpened
        {
            get
            {
                return isPaneOpened;
            }
            set
            {
                SetProperty(ref this.isPaneOpened, value);
            }
        }

Team:
public ICommand PaneOpenCommand
        {
            get
            {
                return new Command(PaneOpening);
            }
        }
        private void PaneOpening()
        {
            IsPaneOpened = !IsPaneOpened;
        }

But the menu does not open, the binding works, I checked

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question