Quantcast
Channel: MVVM Light Toolkit
Viewing all articles
Browse latest Browse all 1826

New Post: RelayCommand strange problem

$
0
0
Hello there,
i'm using the MVVM Light Toolkit for an home made project.

At this stage of the application development i'm trying to add some functionality to some button (mostly change page, show a flyout panel or similar)

the strange is that i define 2 different RelayCommand inside my Constructor, but only one of them works...
so.. the commands:
            OpenSettingsPageCommand = new RelayCommand(() => CurrentPage = settingsPageViewModel);
            OpenMenuCommand = new RelayCommand(() => _menuViewModel.IsMenuOpen = true);
To ensure that my view knows about the command value assigned i also do:
            RaisePropertyChanged(() => OpenSettingsPageCommand);
            RaisePropertyChanged(() => OpenMenuCommand);

            CommandManager.InvalidateRequerySuggested();
CurrentPage is the ContentControl inside my window that represents my pages:
        private AbstractViewModelBase _currentPage;
        public AbstractViewModelBase CurrentPage
        {
            get { return _currentPage; }
            set
            {
                if (_currentPage == value)
                    return;

                _currentPage = value;
                RaisePropertyChanged(() => CurrentPage);
            }
        }
And is Binded in Datatemplate like this:
<ContentControl Name="CurrentPageContentControl" />
The strange fact is that if i try to Bind OpenSettingsPageCommand where i bind OpenMenuCommand it still doesn't work (so its not a Binding problem imho)
Otherwise, Binding OpenMenuCommand where OpenSettingsCommand is Binded works without problem.

Please feel free to ask me any question if i was not clear,
thank you in advance for any answer,

Viewing all articles
Browse latest Browse all 1826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>