DataGrid.CanUserAddRows 属性
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示用户是否可在 DataGrid 中添加新行。
public:
property bool CanUserAddRows { bool get(); void set(bool value); };
public bool CanUserAddRows { get; set; }
member this.CanUserAddRows : bool with get, set
Public Property CanUserAddRows As Boolean
如果用户可添加新行,则为 true
;否则为 false
。 已注册的默认值为 true
。 有关可以影响值的因素的更多信息,请参见 DependencyProperty。
当此属性设置为 true
时,会在 底部 DataGrid显示一个空白行。 用户可以在空白行中输入新项。 添加新行会将项添加到 ItemsSource。 可以通过处理 InitializingNewItem 事件和以编程方式设置值来为新项设置默认值。
产品 | 版本 |
---|---|
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |