[原] XAF How can I change XafDisplayNameAttribute dynamically

void ViewControlsCreated(object sender, EventArgs e)
{
            foreach (StringPropertyEditor item in view.GetItems<StringPropertyEditor>())
            {
                if (((People)View.CurrentObject).Type != null && ((People)View.CurrentObject).Type.Name == "male")
                {
                    if (item.Id == "m1" && item.Caption!= ""Name";"){
                        item.Caption = "Name";
                        View.LoadModel();
                         }
                }
                else
                {
                    if (item.Id == "m1" && item.Caption!= "m1"){
                        item.Caption = "m1";
                        View.LoadModel();
                       }
                }
            }
            
}

 

你可能感兴趣的:(attribute)