BlueSky
BlueSky

Reputation: 747

Why cannot change Monotouch.Dialog.TableView.Background color

Why cannot change MonoTouch.Dialog.TableView.Background color ? I am using the Elements API of MonoTouch.Dialog. It's still gray!

class MyDialogViewController : DialogViewController {

public MyDialogViewController (RootElement root) : base (root)
{
}

public override void LoadView ()
{
    base.LoadView ();
    TableView.BackgroundColor = UIColor.Clear;
    UIImage background = UIImage.FromFile ("Mybackground.png");
    ParentViewController.View.BackgroundColor = UIColor.FromPatternImage (background);
}
}


public partial class MyVC: UINavigationController
{
    public void CreateTestUI()
    {

            var menu = new RootElement("MyMenu"){
            new Section ("test"){
                new StringElement("Test", delegate() { }), ...

        var dv = new MyDialogViewController (menu) {
            Autorotate = true
        };

        // add the nav controller to the window
        this.PushViewController (dv, true); 
      }
  }

Upvotes: 1

Views: 1035

Answers (1)

BlueSky
BlueSky

Reputation: 747

in iPad,must add this line: TableView.BackgroundView = null;

Now it works well,thanks poupou, thanks to all.

   public override void LoadView()
   {
        base.LoadView();
        TableView.BackgroundView = null;
        TableView.BackgroundColor = UIColor.Black;
   }

Upvotes: 6

Related Questions