Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inherit/Set the BackgroundView for RadioGroup generated DialogViewController TableView (MonoTouch.Dialog)

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.

like image 827
bertusaurus Avatar asked Nov 28 '25 23:11

bertusaurus


1 Answers

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.

like image 196
poupou Avatar answered Dec 01 '25 12:12

poupou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!