设置 TextBox.Width="*" 通过代码

发布于 2024-07-21 07:45:20 字数 115 浏览 10 评论 0 原文

有谁知道如何设置 TextBox.Width 属性来填充代码中父容器的其余部分? 在 Xaml 中,我只需将 Width 属性设置为 *,但我不知道如何在代码中执行此操作。

谢谢, 罗伊

Does anyone know how to set the TextBox.Width property to fill up the remainder of the parent container in code? In Xaml, I would simply set the Width property to *, but I can't figure out how to do this in code.

Thanks,
Roy

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

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

发布评论

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

评论(2

夏日落 2024-07-28 07:45:21

尝试以下

textBox.Width = Double.NaN;

Double.NaN(不是数字)相当于任何大小。

Try the following

textBox.Width = Double.NaN;

Double.NaN (not a number) is the equivalent of any size.

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