There are times when I want certain property descriptions to change as other properties change. How to modify the value of an property description at runtime. Is this feasible? How is this achieved? Thank you!
Note that the meta data stored in each RadPropertyStore is retrieved when it is first requested and it is cached for subsequent retrieval. If you change the description attribute at run time, the cached data will remain unchanged and the cached one will be returned. Indeed, the internal mechanism of RadPropertyGrid relies on the metadata and the attributes that are assigned to the properties when the RadPropertyStore is initially assigned. This is why if you try to set the PropertyStoreItem.Description property at run time, you shouldn't see the new description.
However, if you want to change the description attribute at run time, the possible solution that I can suggest is to rebind the RadPropertyGrid. An example is demonstrated below:
publicpartialclassRadForm1 : Telerik.WinControls.UI.RadForm
{
PropertyStoreItem floatItem;
RadPropertyStore store = new RadPropertyStore();
publicRadForm1()
{
InitializeComponent();
floatItem = new PropertyStoreItem(typeof(float),
"Float", 1f, "Property storing a floating point value.");
store.Add(floatItem);
this.radPropertyGrid1.SelectedObject = store;
}
privatevoidradButton1_Click(object sender, EventArgs e)
{
store = new RadPropertyStore();
floatItem.Description = "New description";
store.Add(floatItem);
this.radPropertyGrid1.SelectedObject = null;
this.radPropertyGrid1.SelectedObject = store;
}
}
I hope this information helps. If you have other questions I will be glad to help.
Regards,
Nadya
Progress Telerik
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic. Our thoughts here at Progress are with those affected by the outbreak.