Posted 10 October 2021, 9:39 pm EST - Updated 4 October 2022, 8:38 am EST
Hello
C1.WPF.PropertyGrid.Ja 5.0.20212.110
How to reset Brush to Null?
How to reset Thickness to 0,0,0,0?
Thank you.
Forums Home / ComponentOne / WPF Edition
Posted by: info on 10 October 2021, 9:39 pm EST
Posted 10 October 2021, 9:39 pm EST - Updated 4 October 2022, 8:38 am EST
Hello
C1.WPF.PropertyGrid.Ja 5.0.20212.110
How to reset Brush to Null?
How to reset Thickness to 0,0,0,0?
Thank you.
Posted 11 October 2021, 5:17 am EST
Hi,
Thank you for providing snapshot and sample.
In order to reset property values to default on ResetButton click, you need to handle PropertyReset event of C1PropertyGrid as :
private void Property_Reset(object sender, PropertyBoxChangedEventArgs e)
{
var memberName = e.PropertyBox.PropertyAttribute.MemberName;
if (memberName == "Background")
(e.PropertyBox.CurrentEditor as BrushEditor).SelectedBrush = (Brush)e.PropertyBox.PropertyAttribute.DefaultValue;
else if (memberName == "Margin")
(e.PropertyBox.CurrentEditor as TextBox).Text = e.PropertyBox.PropertyAttribute.DefaultValue.ToString();
}
Please refer the attached modified sample for the same : PropertyGridStudy20211011_Mod.zip
Regards,
Nitin
Posted 11 October 2021, 8:22 am EST
Thank you for your help. It works.