我想要让ID
字段只读。它是数据库中的标识字段,因此用户不会设置它。但是他们希望能够看到它。但是下面的代码分配给DataForm
后仍然允许编辑该值,我错过了什么?
public class StatusChoice : BindableBase
{
private int id;
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Editable(false,AllowInitialValue = false)]
public int ID
{
get { return id; }
set
{
id = value;
OnPropertyChanged();
}
}
}