We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

sfDataGrid DetailViewDefinition - Binding InvalidOperationException exception if view model properties are readonly

Hello,
I have just updated WPF sfDataGrid to the 2015 Vol2.
Before go trough the error detail, I would ask if is available a complete and detailed  "what's new" document about WPF 2015 Vol.2?

In my application I have a UserControl with a sfDataGrid with a DetailsViewDefinition.
DetailsView is a sfDataGrid with seven readonly columns with the following binding definition

<sync:GridTemplateColumn.CellTemplate>
	<DataTemplate>
		<local:StrategyStintView DataContext="{Binding S5, Mode=OneWay}" />
	</DataTemplate>
</sync:GridTemplateColumn.CellTemplate>

if I click on the cell I have the following error (please see complete exception in attached file). As  you can see, binding mode is OneWay.

 

System.InvalidOperationException

 A TwoWay or OneWayToSource binding cannot work on the read-only property 'S5' of type 'ViewModels.MainPanelControls.GridViewModels.DSViewModel'.


S5 property is simply defined as you can see below


public int S5
{
	get { return GetS(5); }
}

the only way that I found to solve this issues is do add a fake set. But in this mode my  ViewModel become dirty in few minutes...

public int S5
{
	get { return GetS(5); }
	set { ; }
}


In release 12.4.0.24 all works fine.


Can you please have a check?

Regards

Sauro



Attachment: sfDataGrid_error_43ba981a.zip

1 Reply

JN Jayaleshwari N Syncfusion Team July 15, 2015 12:51 PM UTC

Hi Sauro,

We were able to reproduce the issue “Binding InvalidOperationException exception if view model properties are readonly” and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,
Jayaleshwari N.


Loader.
Live Chat Icon For mobile
Up arrow icon