Developer Express Code Central example://what to:disable property Editors Based on a business rule////This Example D Emonstrates How to hide and disable property editors via the//Conditional appearance module (the obsolete Conditional Edi Tor state module is//used in versions prior to 11.2). The complete description are available in the//what To:disable property Editors Based on a business rule//(ms-help://deve Xpress. xaf/customdocument3221.htm) Help topic.////can find the sample updates and versions for different programming languages here://http://www.devexpress.com/example=E1672using system;using system.componentmodel;using devexpress.xpo;using Devexpress.data.filtering;using devexpress.expressapp;using devexpress.persistent.base;using Devexpress.persistent.baseimpl;using devexpress.persistent.validation;using Devexpress.expressapp.conditionalappearance;using Devexpress.expressapp.editors;namespace editorstateexample.module {[Defaultclassoptions] [ImageName ("Bo_person ")] public class Contact:baseobject {public Contact (session session): base (session) {} publ IC string Name {get {return getpropertyvalue<string> ("name");} set {setpropertyvalue<string> ("Name", value);} } [Immediatepostdata] public bool Ismarried {get {return getpropertyvalue<bool> ("Ismarrie D "); } set {setpropertyvalue<bool> ("ismarried", value);} } [Appearance ("single", Visibility = viewitemvisibility.hide, Criteria = "! Ismarried ", context=" DetailView ")] public string Spousename {get {return getpropertyvalue<string> ;("Spousename"); } set {setpropertyvalue<string> ("Spousename", value);} } [Immediatepostdata] public string Address1 {get {return getpropertyvalue<string> ("Addre SS1 "); } set {setpropertyvalue<string> ("Address1", value);} } [Appearance ("Addressoneisempty", Enabled = false, Criteria = "IsNullOrEmpty (ADDRESS1)")] public string Address2 { get {return getpropertyvalue<string> ("Address2");} set {setpropertyvalue<string> ("Address2", value);} } }}
reproduced in: http://www.cnblogs.com/Tonyyang/
XAF How to disable properties based on business rules