public override void ViewDidLoad() { Title = "Assignees".t(); NoItemsText = "No Assignees".t(); base.ViewDidLoad(); var vm = (IssueAssignedToViewModel)ViewModel; BindCollection(vm.Users, x => { var el = new UserElement(x.Login, string.Empty, string.Empty, x.AvatarUrl); el.Tapped += () => { if (vm.SelectedUser != null && string.Equals(vm.SelectedUser.Login, x.Login)) vm.SelectedUser = null; else vm.SelectedUser = x; }; if (vm.SelectedUser != null && string.Equals(vm.SelectedUser.Login, x.Login, StringComparison.OrdinalIgnoreCase)) el.Accessory = UITableViewCellAccessory.Checkmark; else el.Accessory = UITableViewCellAccessory.None; return el; }); vm.Bind(x => x.SelectedUser, x => { if (Root.Count == 0) return; foreach (var m in Root[0].Elements.Cast<UserElement>()) m.Accessory = (x != null && string.Equals(vm.SelectedUser.Login, x.Login, StringComparison.OrdinalIgnoreCase)) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; Root.Reload(Root[0], UITableViewRowAnimation.None); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var vm = (BaseUserCollectionViewModel)ViewModel; BindCollection(vm.Users, x => { var e = new UserElement(x.Username, string.Empty, string.Empty, x.Avatar); e.Tapped += () => vm.GoToUserCommand.Execute(x); return e; }); }
public override void ViewDidLoad() { Title = "Organizations".t(); NoItemsText = "No Organizations".t(); base.ViewDidLoad(); var vm = (OrganizationsViewModel) ViewModel; BindCollection(vm.Organizations, x => { var e = new UserElement(x.Login, string.Empty, string.Empty, x.AvatarUrl); e.Tapped += () => vm.GoToOrganizationCommand.Execute(x); return e; }); }