Template10: Command binding on HamburgerButtonInfo not working
Hello
I’m trying to use MVVM all the way using the HamburgerMenu.
Having a ShellViewModel for the Shell.xaml page and then trying to bind a command on the HamburgerButtonInfo control to an ICommand on the VM named ConnectCommand like this:
<Controls:HamburgerButtonInfo ClearHistory="True" ButtonType="Command" Command="{Binding ConnectCommand, Mode=TwoWay}">
The binding is not working and the BindingExpression message on output says “BindingExpression path error: ‘ConnectCommand’ property not found on ‘Template10.Controls.HamburgerButtonInfo’.”
The ButtonType name clearly promotes a “Command” but the documentation on https://github.com/Windows-XAML/Template10/blob/master/Samples/Search/Readme.md says that this gives the possibility to use the Tap event.
Is a real Command not possible to use here and in that case, why this naming?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (7 by maintainers)
Using conventional Binding in a Button and TextBlock outside the Controls:HamburgerMenu works directly. This proves that the problem lies in Template10 Controls:HamburgerMenu.
What is happening here?!?! I can see that the Controls:HamburgerMenu inherit the DataContext properly as a UserControl, but Controls:HamburgerButtonInfo is not a FrameworkElement not containing DataContext. Digging deeper the DataContext is obviously null for it childcontrols. How can binding work for its childcontrols?
Have one of you guys a working example of the Controls:HamburgerMenu in a MVVM fashion binding Command towards a ViewModel e.g. ShellViewModel? If not, have you ever got it to work?