Exemplo n.º 1
0
        public void PopulateElements(LoadMoreElement lme, Section section, string typeLable, string valueLabel, UIKeyboardType entryKeyboardType, string deleteLabel, IList <string> labelList)
        {
            lme.Animating = false;

            var type = new StyledStringElement(typeLable)
            {
                Accessory = UITableViewCellAccessory.DetailDisclosureButton
            };

            section.Insert(section.Count - 1, type);
            var value = new EntryElement(null, valueLabel, null);

            value.KeyboardType = entryKeyboardType;
            section.Insert(section.Count - 1, value);

            var deleteButton = new StyledStringElement(deleteLabel)
            {
                TextColor = UIColor.Red,
            };

            deleteButton.Tapped += () =>
            {
                section.Remove(type);
                section.Remove(value);
                section.Remove(deleteButton);
            };

            // Show/Hide Delete Button
            var deleteButtonOn = false;

            type.AccessoryTapped += () =>
            {
                if (!deleteButtonOn)
                {
                    deleteButtonOn = true;
                    section.Insert(type.IndexPath.Row + 2, UITableViewRowAnimation.Bottom, deleteButton);
                }
                else
                {
                    deleteButtonOn = false;
                    section.Remove(deleteButton);
                }
            };

            type.Tapped += () =>
            {
                var labelScreen = new LabelListScreen(labelList);
                var navigation  = new UINavigationController(labelScreen);
                NavigationController.PresentViewController(navigation, true, null);
            };
        }
Exemplo n.º 2
0
        public void PopulateElements(LoadMoreElement lme, Section section, string typeLable, string valueLabel, UIKeyboardType entryKeyboardType, string deleteLabel, IList<string> labelList)
        {
            lme.Animating = false;

            var type = new StyledStringElement(typeLable) { Accessory = UITableViewCellAccessory.DetailDisclosureButton };
            section.Insert(section.Count - 1, type);
            var value = new EntryElement(null, valueLabel, null);
            value.KeyboardType = entryKeyboardType;
            section.Insert(section.Count - 1, value);

            var deleteButton = new StyledStringElement(deleteLabel)
            {
                TextColor = UIColor.Red,
            };

            deleteButton.Tapped += () =>
            {
                section.Remove(type);
                section.Remove(value);
                section.Remove(deleteButton);
            };

            // Show/Hide Delete Button
            var deleteButtonOn = false;
            type.AccessoryTapped += () =>
            {
                if (!deleteButtonOn)
                {
                    deleteButtonOn = true;
                    section.Insert(type.IndexPath.Row + 2, UITableViewRowAnimation.Bottom, deleteButton);
                }
                else
                {
                    deleteButtonOn = false;
                    section.Remove(deleteButton);
                }
            };

            type.Tapped += () =>
            {
                var labelScreen = new LabelListScreen(labelList);
                var navigation = new UINavigationController(labelScreen);
                NavigationController.PresentViewController(navigation, true, null);
            };
        }