在带有 Silverlight 的 DataForm 中使用密码文本框

发布于 2024-10-01 18:02:50 字数 247 浏览 0 评论 0原文

是否有一种惯用的方法来指示此模型中的字段应该是密码文本框:

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

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

如果没有一种惯用的方法来自动生成密码文本框,那么有没有比挂钩到自动生成之一更好的方法事件?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

擦肩而过的背影 2024-10-08 18:02:50

不幸的是没有。如果您查看使用 Silverlight 业务应用程序项目模板创建的项目中的 LoginForm 类,您会发现它使用自定义控件(CustomDataForm,也在项目中)来帮助实现相同的功能。因此,如果需要,您可以抓住它并在您的项目中使用它来代替标准 DataForm 控件。否则,只需为 DataForm 提供您自己的 EditTemplate(这通常是我使用 DataForm 控件时的首选方法,而不是让它自动生成控件)。这样做需要更多的工作,但它也是布置数据表单的更灵活的方式。

希望这有帮助......

克里斯

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

溇涏 2024-10-08 18:02:50

也许这可以帮助:Silverlight DataForm DataField 与 PasswordBox。这是一种实际挂钩到 AutoGenerateField 事件的解决方法。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文