MonoTouch.Dialog.RootElement.PathForRadio C# (CSharp) Method

PathForRadio() private method

private PathForRadio ( int idx ) : NSIndexPath
idx int
return NSIndexPath
		internal NSIndexPath PathForRadio (int idx)
		{
			RadioGroup radio = group as RadioGroup;
			if (radio == null)
				return null;
			
			uint current = 0, section = 0;
			foreach (Section s in Sections){
				uint row = 0;
				
				foreach (Element e in s.Elements){
					if (!(e is RadioElement))
						continue;
					
					if (current == idx){
						return NSIndexPath.Create(section, row); 
					}
					row++;
					current++;
				}
				section++;
			}
			return null;
		}
		

Usage Example

示例#1
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            RootElement     root = (RootElement)Parent.Parent;
            UITableViewCell cell = null;

            if (RadioIdx != root.Value)
            {
                var indexForOldItem = root.PathForRadio(root.Value);
                if (indexForOldItem != null)
                {
                    cell = tableView.CellAt(indexForOldItem);
                    if (cell != null)
                    {
                        cell.Accessory = UITableViewCellAccessory.None;
                    }
                }
                cell = tableView.CellAt(indexPath);
                if (cell != null)
                {
                    cell.Accessory = UITableViewCellAccessory.Checkmark;
                }
                root.Value = RadioIdx;
            }

            base.Selected(dvc, tableView, indexPath);

            if (PopOnSelect)
            {
                dvc.NavigationController.PopViewControllerAnimated(true);
            }
        }
All Usage Examples Of MonoTouch.Dialog.RootElement::PathForRadio