0

I am creating SlideNavigation Drawer in ios(Xamarin). and I have created with help of below link

https://github.com/thedillonb/MonoTouch.SlideoutNavigation

The code is working fine as I want.

Code :

class DummyControllerLeft : DialogViewController
    {
        float labelHeight;

        UIImageView profileImage;

        public DummyControllerLeft()
           : base(UITableViewStyle.Plain, new RootElement(""))
        {
            this.labelHeight = labelHeight;

            Root.Add(new Section()
            {
                new StyledStringElement("Home", () => NavigationController.PushViewController(new HomeViewController(), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear, Font = UIFont.FromName("Helvetica-Bold", 16f) },

            });
            TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            TableView.BackgroundColor = UIColor.Clear.FromHexString("#0072BA", 1.0f);

        }
}

But As you can see I have only able to add String name in my code case it is "Home". Now I want to add Image.

I search lot's of thing in google and SO. But nothing is work me.

Any Help will be Appreciated.

Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95

1 Answers1

1

You can set Image property of StyledStringElement That will solve your problem.

StyledStringElement home = new StyledStringElement ("Home", () => NavigationController.PushViewController (new HomeViewController (), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear };
home.Image = new UIImage ("noimage.png");

Root.Add (new Section () {
                        home
                    });
PlusInfosys
  • 3,416
  • 1
  • 19
  • 33