Skip to content

Instantly share code, notes, and snippets.

@migueldeicaza
Created January 20, 2010 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save migueldeicaza/281469 to your computer and use it in GitHub Desktop.
Save migueldeicaza/281469 to your computer and use it in GitHub Desktop.
//
// 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