snippets dataprop and vmprop

Mar 28, 2012 at 2:57 PM

whats the difference of this two?

And why is there a datapropchanged but no vmpropchanged?

Coordinator
Mar 28, 2012 at 3:16 PM

Almost no difference. But, if you are developing data objects, the dataprop is the right prefix, and the same for vm :)

Mar 28, 2012 at 3:21 PM

And the second question. Why is there no vmpropchanged?

Mar 28, 2012 at 3:28 PM

And there is a difference.

Intended or not. In the dataprop there is a defaultvalue in vmprop not!

Coordinator
Mar 28, 2012 at 3:34 PM

That is intended, that is the small difference. There is no vmpropchange because you hardly need one, but we might create it on request ;)

Mar 29, 2012 at 6:54 AM

Is this small difference intended. Why is there no defaultvalue in vmprop.

An correct me. I need more often the vmpropchange than the datapropchange

Coordinator
Mar 29, 2012 at 7:17 AM

In the old days, when there was only a DataObjectBase, you was forced to set the default value. However, now the class uses the default(T) to determine the default value of a type.

When I wrote the vmprop, I noticed I hardly uses the default value in view models (because they are mapped to models most of the time). That's why this difference is intended.

I will create the vmpropchanged code snippet.

Coordinator
Mar 29, 2012 at 7:25 AM

And I have committed it:

http://catel.codeplex.com/SourceControl/changeset/view/ac2816fd2b2d#snippets%2fC%23%2fvmpropchanged.snippet

Mar 29, 2012 at 9:22 AM

"because they are mapped to models most of the time" ??

I thought only the vmpropviewmodeltomodel propertys where mapped to models

Coordinator
Mar 29, 2012 at 9:27 AM

True, but that code snippet came after the original vmprop :)

If you want a default value, you can use dataprop, if you don't want a default value, use vmprop. Do you set the default value for VM often?

Mar 29, 2012 at 10:36 AM

I always set a default value. I should make no difference if the prop is in model or in viewmodel. Or what do you think?

Coordinator
Apr 2, 2012 at 7:19 PM

I have added the default value to the vmprop definitions, also made the default value of the "defaultvalue" (confusing, yeah) null instead of "defaultvalue", so if you don't type it, it takes the default by default.