public override void ViewDidLoad() { base.ViewDidLoad(); var notificationSource = new NotificationTableViewSource(TableView); TableView.AllowsMultipleSelectionDuringEditing = true; ViewModel.WhenAnyValue(x => x.GroupedNotifications).Where(x => x != null).Subscribe(notificationSource.SetData); TableView.Source = notificationSource; _viewSegment.ValueChanged += (sender, args) => ViewModel.ActiveFilter = (int)_viewSegment.SelectedSegment; }
public override void ViewDidLoad() { base.ViewDidLoad(); _segmentBarButton.Width = View.Frame.Width - 10f; ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; NavigationItem.RightBarButtonItem = new UIBarButtonItem { Image = Theme.CurrentTheme.CheckButton }.WithCommand(ViewModel.ReadAllCommand); var notificationSource = new NotificationTableViewSource(TableView); notificationSource.ElementSelected.OfType <NotificationModel>().Subscribe(x => ViewModel.GoToNotificationCommand.ExecuteIfCan(x)); ViewModel.WhenAnyValue(x => x.GroupedNotifications).Where(x => x != null).Subscribe(notificationSource.SetData); TableView.Source = notificationSource; _viewSegment.ValueChanged += (sender, args) => ViewModel.ShownIndex = _viewSegment.SelectedSegment; }