0

I'm writing some codes for iOS using c# in Xamarin Studio. In a dialogViewController , I'm creating a rootElement that has several Sections.How can I Align Right ,Caption and Elements of a Section. I'm creating the rootElement like this:

 RootElement  CreateRootElement ()
{       
  return new RootElement ("RootElement") 
  {
  new Section ("Caption1") {
    (createFirstElement ())
    },
  new Section ("Caption2")) {
    (createSecondElement ())
    }
  };
}

List<Element> createFirstElement ()
{
 List<Element> myList;
 //fill this list
 return myList;
}
user3243726
  • 11
  • 1
  • 3

1 Answers1

0

You can create a right aligned section caption by using the Section initializer 'public Section(UIView header)' with the following method:

private UILabel LabelForSection(string title) {
    RectangleF frame = new RectangleF(0, 0, UIScreen.MainScreen.Bounds.Width, 22);
    UILabel label = new UILabel(frame);
    label.TextAlignment = UITextAlignment.Right;
    label.Text = "Caption1";
    return label;
}

And then initialize your section like so:

new Section(LabelForSection("Caption1"))

Can you give an example of what you mean when you say:

How can I Align Right Elements of a Section?

Will Decker
  • 3,216
  • 20
  • 30