public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { if (RowSelectedEvent != null) { this.selectedItem = Items[indexPath.Row]; RowSelectedEvent(this, EventArgs.Empty); } tableView.DeselectRow(indexPath, true); }
public override void ViewDidLoad() { base.ViewDidLoad(); profileImage.UserInteractionEnabled = true; var selectImageTapped = new UITapGestureRecognizer(() => { ShowUpdateUserProfileViewController(); }); profileImage.AddGestureRecognizer(selectImageTapped); setProfileDetails(); List <MenuListItem> _ObjMenuList = new List <MenuListItem>(); MenuListItem _ChatsMenu = new MenuListItem(); _ChatsMenu.Name = "Chats"; _ChatsMenu.ImageUrl = "ic_chats24.png"; _ObjMenuList.Add(_ChatsMenu); MenuListItem _ContactsMenu = new MenuListItem(); _ContactsMenu.Name = "Contacts"; _ContactsMenu.ImageUrl = "ic_contacts32.png"; _ObjMenuList.Add(_ContactsMenu); MenuListItem _BookShelfMenu = new MenuListItem(); _BookShelfMenu.Name = "Inpowerment Institute"; _BookShelfMenu.ImageUrl = "ic_bookshelf32.png"; _ObjMenuList.Add(_BookShelfMenu); MenuListItem _SettingMenu = new MenuListItem(); _SettingMenu.Name = "Setting"; _SettingMenu.ImageUrl = "ic_settings32.png"; _ObjMenuList.Add(_SettingMenu); MenuListItem _InviteFriendsMenu = new MenuListItem(); _InviteFriendsMenu.Name = "Invite Friends"; _InviteFriendsMenu.ImageUrl = "InviteFriends.png"; _ObjMenuList.Add(_InviteFriendsMenu); MenuListItem _LogoutMenu = new MenuListItem(); _LogoutMenu.Name = "Logout"; _LogoutMenu.ImageUrl = "ic_logout32.png"; _ObjMenuList.Add(_LogoutMenu); // tbl_MenuList.RowHeight = 60 menuTableview = new MenuListSource(_ObjMenuList); var mainchatscontroller = (MainScreenTabBarController)Storyboard.InstantiateViewController("MainScreenTabBarController"); NavController.PushViewController(mainchatscontroller, true); mainchatscontroller.SelectedIndex = 0; menuTableview.RowSelectedEvent += (sender, e) => { var Data = ((MenuListSource)sender).selectedItem; switch (Data.Name) { case "Chats": var Chatscontroller = (MainScreenTabBarController)Storyboard.InstantiateViewController("MainScreenTabBarController"); NavController.PushViewController(Chatscontroller, true); Chatscontroller.SelectedIndex = 0; SidebarController.CloseMenu(); break; case "Contacts": var contactscontroller = (MainScreenTabBarController)Storyboard.InstantiateViewController("MainScreenTabBarController"); // if (NavController.TopViewController as MainScreenTabBarController == null) NavController.PushViewController(contactscontroller, true); contactscontroller.SelectedIndex = 1; SidebarController.CloseMenu(); break; case "Inpowerment Institute": var BookShelfcontroller = (BooksTabBarController)Storyboard.InstantiateViewController("BooksTabBarController"); // if (NavController.TopViewController as MainScreenTabBarController == null) NavController.PushViewController(BookShelfcontroller, true); BookShelfcontroller.SelectedIndex = 0; SidebarController.CloseMenu(); break; case "Setting": var Settingcontroller = (SettingViewController)Storyboard.InstantiateViewController("SettingViewController"); NavController.PushViewController(Settingcontroller, true); SidebarController.CloseMenu(); break; case "Invite Friends": var inviteFriendsViaSMSViewController = (InviteFriendsViaSMSViewController)Storyboard.InstantiateViewController("InviteFriendsViaSMSViewController"); NavController.PushViewController(inviteFriendsViaSMSViewController, true); SidebarController.CloseMenu(); break; case "Logout": LogoutUser(); break; } }; SideHeaderBackgroundView.BackgroundColor = ColorExtensions.NavigationColor(); tbl_MenuList.Source = menuTableview; tbl_MenuList.ReloadData(); }