public MainPage() { InitializeComponent(); dateSelector.Date = DateTime.Today; tasks = (Resources["timedTasksViewModel"] as TimedTasksViewModel); ToolbarFinished.Command = tasks.ChangeFinishedVisibilityCommand; ToolbarFinished.BindingContext = tasks; ToolbarFinished.SetBinding(MenuItem.IconProperty, "FinishedTasksVisible", converter: new SetValueIfTrueConverter() { TrueValue = ImageSource.FromFile("baseline_visibility_white_36dp.png"), FalseValue = ImageSource.FromFile("baseline_visibility_off_white_36dp.png") }); this.BindingContext = tasks; this.SetBinding(ContentPage.TitleProperty, "Title"); this.ToolbarItems.Add(new ToolbarItem() { Text = "Denní úkoly", Order = ToolbarItemOrder.Secondary, Command = tasks.ShowDailyTasksCommand }); this.ToolbarItems.Add(new ToolbarItem() { Text = "Všechny úkoly", Order = ToolbarItemOrder.Secondary, Command = tasks.ShowAllTasksCommand }); //this.ToolbarItems.Add(new ToolbarItem() { Text = "Nastavení", Order = ToolbarItemOrder.Secondary, Command = new Command(async() => { await Navigation.PushAsync(new SettingsPage()); }) }); }
private void TasksGrid_PreviewMouseDown(object sender, MouseButtonEventArgs e) { TimedTasksViewModel dataContext = (TimedTasksViewModel)this.DataContext; if (dataContext == null) { return; } var source = e.OriginalSource; if (source == null) { return; } if (source is Visual == false || source is IInputElement == false) { return; } Visual visualSource = (Visual)source; var parentButton = visualSource.GetParentOfType <Button>(); var parentRow = visualSource.GetParentOfType <DataGridRow>(); if (parentButton != null) { parentButton.ClickButton(); e.Handled = true; return; } if (dataContext.AutomaticallySwitchTasks) { } else { if (parentRow == null) { return; } TaskViewModel task = parentRow.DataContext as TaskViewModel; if (task == null) { return; } //if(task.) } }
private void TasksGrid_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { TimedTasksViewModel dataContext = (TimedTasksViewModel)this.DataContext; if (dataContext == null) { return; } if (dataContext.AutomaticallySwitchTasks) { e.Handled = true; return; } }