Question

Is there an idiomatic way to indicate that a field in this model should be a password text box:

public class User
{
   [Required]
   public string Username { get; set; }

   [Required]
   public string Password { get; set; }
}

If there isn't an idiomatic way to auto-generate a password text box, is there a better way than hooking into one of the auto generation events?

Was it helpful?

Solution

Unfortunately not. If you take a look at the LoginForm class in a project created using the Silverlight Business Application project template, you'll find that it makes use of a custom control (CustomDataForm, also in the project) to help achieve this same functionality. So you can grab this and use it in your project in place of the standard DataForm control if you want. Otherwise, simply provide your own EditTemplate for the DataForm instead (which is usually my preferred means when using the DataForm control instead of having it automatically generate the controls). It's more work to do so, but it's also much more flexible way to lay out data forms.

Hope this helps...

Chris

OTHER TIPS

Maybe this can help: Silverlight DataForm DataField vs PasswordBox. It's a workaround that actually hooks into the AutoGeneratingField event.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top