-
-
Save tp/2012387 to your computer and use it in GitHub Desktop.
RightAlignedEntryElement: A right aligned EntryElement for MonoTouch.Dialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// A right aligned MonoTouch.Dialog EntryElement to use and build upon | |
/// | |
/// @tp on github, 2012 | |
/// </summary> | |
using System.Drawing; | |
using MonoTouch.Dialog; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
namespace Controls | |
{ | |
public class RightAlignedEntryElement : EntryElement | |
{ | |
private NSString _cellKey = new NSString("RightAlignedEntryElement"); | |
public RightAlignedEntryElement (string caption) : base(caption, null, null) | |
{ | |
} | |
protected override UITextField CreateTextField(RectangleF frame) | |
{ | |
var textField = base.CreateTextField (frame); | |
textField.TextAlignment = UITextAlignment.Right; | |
// shrink textfield a little to have some nice border | |
textField.Frame = new RectangleF(new PointF(textField.Frame.Location.X, textField.Frame.Location.Y), new SizeF(textField.Frame.Size.Width - 10, textField.Frame.Size.Height)); | |
return textField; | |
} | |
public override UITableViewCell GetCell(UITableView tv) | |
{ | |
var cell = base.GetCell (tv); | |
return cell; | |
} | |
protected override NSString CellKey { | |
get { | |
return _cellKey; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment