A command whose sole purpose is to relay its functionality to other objects by invoking delegates. The default return value for the CanExecute method is 'true'. RaiseCanExecuteChanged needs to be called whenever CanExecute is expected to return a different value.
Inheritance: ICommand
 public SearchBarViewModel()
 {
     InitializeDispatcherFromCurrentThread();
     ToggleSearchBarExpansion = new RelayCommand(_ => {
         IsSearchExpanded = !IsSearchExpanded; 
     });
 }
Example #2
0
        public EventService(IDataContext dataContext, ToastNotificationService toastNotificationService)
        {
            _dataContext = dataContext;
            _toastNotificationService = toastNotificationService;

            ToggleFavoriteStatusCommand = new RelayCommand((p) => ToggleFavoriteStatus((EventEntry)p));
        }
Example #3
0
        public EventsViewModel(IEventsViewModelContext eventsViewModelContext)
        {
            InitializeDispatcherFromCurrentThread();
            _eventsViewModelContext = eventsViewModelContext;

            EventEntrySearchResults = new ObservableCollection<EventEntryViewModel>();

            if (DesignMode.DesignModeEnabled) SearchText = "Furry";

            AddEventToCalendarCommand = new RelayCommand(AddEventToCalendarAsync);
        }
        public NavigationViewModel(INavigationMediator navigationMediator)
        {
            _navigationMediator = navigationMediator;

            NavigateToMainPage = new RelayCommand(_ => { _navigationMediator.NavigateAsync(typeof(Views.MainPage)); });
            NavigateToDebugPage = new RelayCommand(_ => { _navigationMediator.NavigateAsync(typeof(Views.DebugPage)); });
            NavigateToInfoPage = new RelayCommand(_ => { _navigationMediator.NavigateAsync(typeof(Views.InfoPage)); });
            NavigateToInfoGroupDetailPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.InfoGroupDetailPage), p); });
            NavigateToEventsPage = new RelayCommand(_ => { _navigationMediator.NavigateAsync(typeof(Views.EventsPage)); });

            NavigateToEventsByDayPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.EventsByDayPage), p); });
            NavigateToEventsByTrackPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.EventsByTrackPage), p); });
            NavigateToEventsByRoomPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.EventsByRoomPage), p); });

            NavigateToEventDetailPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.EventDetailPage), p); });
            NavigateToLoadingPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.LoadingPage), p); });
            NavigateToDealerListPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.DealerListPage), p); });
            NavigateToDealerDetailPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.DealerDetailPage), p); });
            NavigateToAboutPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.AboutPage), p); });
            NavigateToAnnouncementDetailPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.AnnouncementDetailPage), p); });
            NavigateToImageViewerPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.ImageViewerPage), p); });
            NavigateToMapDetailPage = new RelayCommand(p => { _navigationMediator.NavigateAsync(typeof(Views.MapDetailPage), p); });
        }