2

i wan't to use UITableView.AllowsMultipleSelectionDuringEditing with Monotouch.Dialog. If the property is set to true, the click on the table (with edit mode enabled) seems to be ignored (no selection happens). If there is an Element.Tapped, it will be executed. In my current implementation it will push a new UIView to the NavigationController, but this is not what you expect in edit-mode.

You can reproduce the behaviour with the monotouch.dialog-sample project, just change the EditingDialog Constructor (DemoEditing.cs:57) to the following:


    public EditingDialog (RootElement root, bool pushing) : base (root, pushing)
    {
      TableView.AllowsMultipleSelectionDuringEditing = true;
    }

Is there a way to use AllowsMultipleSelectionDuringEditing? If yes, what's wrong with my approach?

unreal
  • 1,259
  • 12
  • 17
  • Could you solve this finally? I've been puzzled with this for a while... – P. Sami May 07 '13 at 14:10
  • sorry i didn't recognize your comment. are you still interested? i did a workaround but i've to grab that from my repository first. – unreal Oct 21 '13 at 10:50
  • No worries unreal! I've already totally forgotten about it, I think I came up with a workaround for it as well... – P. Sami Oct 21 '13 at 12:42

1 Answers1

0

I just had the same problem with my own code. The problem is that some of the MonoTouch.Dialog elements have their cell SelectionStyle set to UITableViewCellSelectionStyle.None.

I solved it by sub-classing Source or SizingSource:

public class MyTableViewSource : Source
{
    public MyTableViewSource(DialogViewController container) : base(container)
    {
    }

    public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
    {
        var cell = base.GetCell(tableView, indexPath);
        cell.SelectionStyle = UITableViewCellSelectionStyle.Gray; // something other than None
        return cell;
    }
}

Then in your DialogViewController:

public class MyDialogController : DialogViewController
{
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        // setup root element
        Root = new RootElement();

        // . . .

        TableView.Source = new MyTableViewSource(this);
        TableView.AllowsMultipleSelectionDuringEditing = true;
    }
}
mb77
  • 1