+1.
I use snippets for this sort of stuff, which makes generating all that
code very easy.
The project I work on also uses a base class to hide the event. It's
quite a large project, and I haven't seen it get in the way of doing
anything else.
I haven't tried the aspect idea (re:PostSharp). I wonder how this would
affect Blendability?
Carl.
Carl Scarlett
Senior .NET/WPF Developer, UX Designer - Genesis Team
IT Applications Delivery | Bankwest
A: Level 5, 199 Hay Street | Perth | Western Australia | 6004
P: (08) 9449 8703
M: 0408 913 870
E: [email protected]
From: [email protected]
[mailto:[email protected]] On Behalf Of Richard
Mason <[email protected]>
Sent: Friday, 28 May 2010 2:22 PM
To: ozSilverlight <[email protected]>
Subject: Re: Lots of bind/notify classes
Hi Greg,
I hear your pain and reflect it.
You could probably set up a method using PostSharp to automatically
create the necessary setter code, but that's provided you can introduce
PostSharp into your process.
The best I've managed is to set up a Visual Studio code snippet to help
create them quickly. I deferred doing that for a long time, but recently
got around to it and it does make things much less painful. But
unfortunately still far from ideal. Just grab the existing 'prop' code
snippet and expand it out from there. 'tis fairly simple to do and well
worth the effort.
ciao, Richard
On Fri, May 28, 2010 at 4:18 PM, Greg Keogh <[email protected]> wrote:
Look Dave, I can see you're really upset about this. I honestly think
you ought to sit down calmly, take a stress pill, and think things over
- HAL (2001)
I was wondering if anyone has found a nice way of creating/managing lots
of classes that are suitable for binding and implement
INotifyPropertyChanged. As you know, you have to keep coding properties
like this:
public string CompanyName
{
get {return this.companyNameValue;}
set
{
if (value != this.companyNameValue)
{
this.companyNameValue = value;
NotifyPropertyChanged("CompanyName");
}
}
}
You can create a simple base class to factor out the event, but not
much else, as there is no way I know of to intercept any arbitrary
property setter and add custom processing. Is that right?! Coding the
above skeleton dozens or hundreds of times gets tedious and I'm hoping
there's a better way. I did consider using a T4 generator to spit out
the classes, but that's an obtuse way around the problem and will
require extra research time (but I see others have done it already).
I have dozens of existing classes with dozens of properties and I'd like
to use them for binding, but I'd have to expand every property to be
like the same above, which would be hell.
Greg
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
________________________________________________________________________
_______
This email has been scanned by the Bankwest Email Security System.
________________________________________________________________________
_______
_______________________________________________________________________________
Unencrypted electronic mail is not secure and may not be authentic.
If you have any doubts as to the contents please telephone to confirm.
This electronic transmission including any attachments is intended only
for those to whom it is addressed. It may contain copyright material or
information that is confidential, privileged or exempt from disclosure by law.
Any claim to privilege is not waived or lost by reason of mistaken transmission
of this information. If you are not the intended recipient you must not
distribute or copy this transmission and should please notify the sender.
Your costs for doing this will be reimbursed by the sender.
We do not accept liability in connection with computer virus, data corruption,
delay, interruption, unauthorised access or unauthorised amendment.
_______________________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
_____________________________________________________________________________________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight