Make Property editable in sfDataGrid, but Readonly in PropertyGrid

Hello,

I have a collection of objects that is the data source for both a datagrid and a property grid. I want the properties to be read-only in property grid, but I want to be able to edit the values through the datagrid. Is there any way to do this?



1 Reply

VS Vijayarasan Sivanandham Syncfusion Team February 3, 2022 02:40 PM UTC

Hi Nour Douffir, 

Please find answer for your queries below 

Queries 
Solutions 
 
I want the properties to be read-only in property grid 
 

You can achieve the “ReadOnly for PropertyGrid” requirement by using the attributes and event as read-only property is true. We have prepared the sample to achieve the requirement. Pease find the sample from the below link,

Sample Link:  https://www.syncfusion.com/downloads/support/forum/172521/ze/ReadOnlyProperty-681387473

You can also check this documentation for more details,

UG Link: https://help.syncfusion.com/wpf/propertygrid/readonly-attribute 

 
but I want to be able to edit the values through the datagrid 
 

Your requirement to edit data in SfDataGrid can be achieved by enable or disable the AllowEditing property in SfDataGrid. Please refer the below code snippet, 

<syncfusion:SfDataGrid x:Name="sfDataGrid"                           
                                          ItemsSource="{Binding Orders}" 
                                          AllowEditing="True" /> 

Sample Link: https://www.syncfusion.com/downloads/support/forum/172521/ze/SfDataGridDemo84580982

For more information related to Editing, please refer the below user guide documentation link, 





Please let us know if you have any concerns in this. 

Regards, 
Vijayarasan S 


Loader.
Up arrow icon