使用新的 ColumnDefinition 语法时,我如何表示 <ColumnDefinition/> [英] When using the new ColumnDefinition syntax, how can I represent <ColumnDefinition />

查看:30
本文介绍了使用新的 ColumnDefinition 语法时,我如何表示 <ColumnDefinition/>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码:

<Grid.ColumnDefinitions>
   <ColumnDefinition />
   <ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>

谁能告诉我如何使用新的快捷方式来表示这个?

Can someone tell me how I can represent this using the new shortcut?

<Grid ColumnDefinitions=" ,50">

特别是我不确定要为第一个 ColumnDefinition 放什么,在我的代码中,它目前只是斜杠前的一个空格.

In particular I am not sure what to put for the first ColumnDefinition which in my code is currently just a space before the slash.

相关:

提案:简化网格列和行定义 #673

推荐答案

网格文档页面Width(或HeightRowDefinitions 的情况下)的默认值是*.

As noted on the Grid Docs page the default value for Width (or Height in the case of RowDefinitions) is *.

RowDefinition.Height 属性的默认值为 *.同样,ColumnDefinition.Width 属性的默认值为 *.因此,在这些默认值可以接受的情况下,没有必要设置这些属性.

The default value of the RowDefinition.Height property is *. Similarly, the default value of the ColumnDefinition.Width property is *. Therefore, it's not necessary to set these properties in cases where these defaults are acceptable.

(来自撰写本文时页面上的第一个重要"框)

(from the first "Important" box on the page at the time of writing)

这意味着,只要您没有明确指定属性,其值为 *.因此,当您想使用速记符号时,您需要使用 *

That means, whenever you don't specify the property explicitly, the value is *. So when you want to use the short-hand notation you would need to use *

这篇关于使用新的 ColumnDefinition 语法时,我如何表示 &lt;ColumnDefinition/&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆