3
votes

I want to use MonoTouch.Dialog RadioElements for selecting data and it has to have a UIImageView for the TableView BackgroundViews.

I can set the BackgroundView on the initial DialogViewController's TableView so no problem there, but the TableView's generated for each RadioGroup has the default grey background image and I can't seem to find a way to change them to the same background style as the initial TableView.

Is it possible to change the generated TableView's BackgroundView (the TableView's generated for each RadioGroup) without having to go and modify the MonoTouch.Dialog source?

Thanks in advance.

2
Sorry I mis-read your original question. I was under the impression that RadioGroup was non-UI related, i.e. without a table (need to check that again). Could it be the RootElement's TableView ? If so the same inherit-and-override trick would do. - poupou
It is, which I discovered earlier. Thanks! - bertusaurus
So what was the final answer? - Dylan

2 Answers

3
votes

AFAIK you'll need to create your own Element. But the good news is that's pretty easy to do, e.g.:

public class TransparentRootElement : RootElement {

    // add required .ctors

    public override UITableViewCell GetCell (UITableView tv)
    {
        var cell = base.GetCell (tv);
        cell.BackgroundColor = UIColor.Clear;
        return cell;
    }
}

Then you only have to use this new TransparentRootElement type where you create the RadioGroup.

0
votes
public class CustomRootElement : RootElement
{
    public CustomRootElement(string caption, RadioGroup group) : base(caption, group)
    {

    }
    protected override MonoTouch.UIKit.UIViewController MakeViewController()
    {
        DialogViewController result = (DialogViewController)base.MakeViewController();
        // set the background here
        result.TableView.BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor;

        return result;
    }

}