如何访问 Silverlight DataForm 中生成的文本框?

发布于 2024-10-08 17:00:00 字数 139 浏览 0 评论 0原文

我有一个 DataForm 绑定到一个具有一些文本字段的简单对象。 DataForm 正确地自动为每个字符串字段生成一个文本框。现在,我需要从代码中将焦点设置到生成的 TextBox 元素之一。如何从 DataForm 中获取生成的元素,以便我可以将焦点设置到它?

I have a DataForm bound to a simple object that has some text fields. The DataForm correctly auto generates a TextBox for each of the string fields. From code I now need to set the focus to one of those generated TextBox elemetns. How do you get the generated element from the DataForm so I can set focus to it?

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

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

发布评论

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

评论(1

回首观望 2024-10-15 17:00:00

使用DataFormAutoGenerateField事件。
以下是如何获取名称为 ID 的属性的示例

   
void dataForm1_AutoGeneratingField(object sender, DataFormAutoGeneratingFieldEventArgs e)
{
   if (e.PropertyName == "ID")
   {
       // set focus
   }
}

Use AutoGeneratingField event of DataForm.
Here is example how to get property with name ID

   
void dataForm1_AutoGeneratingField(object sender, DataFormAutoGeneratingFieldEventArgs e)
{
   if (e.PropertyName == "ID")
   {
       // set focus
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文