Created
January 20, 2010 00:23
-
-
Save migueldeicaza/281469 to your computer and use it in GitHub Desktop.
This file contains 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
// | |
// The entire UI created at http://tirania.org/tmp/a.png | |
// is created, rendered and maintained with the following | |
// code. | |
// | |
// But @JosephHill would like *more* metadata, he would | |
// like *more* typing and would like *more* explicit this | |
// and *explicit* that | |
// | |
// Those of us that were born with good taste, reject that | |
// | |
class Settings { | |
[Section] | |
public bool AccountEnabled; | |
[Section ("Account", "Your credentials")] | |
[Entry ("Enter your login name")] | |
public string Login; | |
[Password ("Enter your password")] | |
public string Password; | |
[Section ("Time Editing")] | |
public TimeSettings TimeSamples; | |
[Section ("Enumerations")] | |
[Caption ("Favorite CLR type")] | |
public TypeCode FavoriteType; | |
} | |
public class TimeSettings { | |
public DateTime Appointment; | |
[Date] | |
public DateTime Birthday; | |
[Time] | |
public DateTime Alarm; | |
} | |
public partial class AppDelegate | |
{ | |
public void DemoReflectionApi () | |
{ | |
var s = new Settings () { | |
AccountEnabled = true, | |
Login = "miguel@novell.com", | |
Appointment = DateTime.Now, | |
Birthday = new DateTime (1980, 6, 24), | |
Alarm = new DateTime (2000, 1, 1, 7, 30, 0, 0) | |
}; | |
var bc = new BindingContext (s, "Settings"); | |
var dv = new DialogViewController (bc.Root); | |
navigation.PushViewController (dv, false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment