Re: Invalid XML (addendum)

2010-08-01 Thread Miguel Madero
If you can use System.Interactivity, I would suggest to use a
CallMethodAction Behavior instead of Commands.

On Sun, Aug 1, 2010 at 6:16 PM, .net noobie dotnetnoo...@gmail.com wrote:


 http://www.cauldwell.net/patrick/blog/MVVMBindingToCommandsInSilverlight.aspx

 here is a plain/no frills example of Silverlight 3 ICommand button
 service
 very plain, no junk, just an example for how to hook up a command to a
 button in SL 3

 I downloaded the code and ran it and it worked fine for me

 On Sun, Aug 1, 2010 at 1:18 PM, Greg Keogh g...@mira.net wrote:


 http://slextensions.codeplex.com/SourceControl/changeset/view/35533#395012



 OK! I manually copied over Command, CommandService, CommandSusbcription
 and some other related EventArgs classes to my project. Following the sample
 XAML in their project which binds a Button to a command in the controller, I
 wired it all up and clicked the Button...



 And nothings happens. I’ve shuffled code around and tried every trick I
 can think of to coax it into life, but the command doesn’t fire, nothing
 happens.



 I’ve spent about 5 solid hours of my spare time over the last week trying
 to get a SL3 binding from a click event in the control to a method in my
 controller. I’ve waded through hundreds of web pages, I’ve tried various
 versions of DelegateCommand, RelayCommand and now these codeplex extensions.
 They all either do nothing, or cause catastrophic exceptions or break the
 Blend 3 designer. The closest I came was with RelayCommand, which actually
 works at runtime and I get bound method is invoked, but the Command=
 element is not recognised and breaks Blend.



 The ever dwindling remaining part of my lifespan is draining away before
 my eyes as I spend hours (and days sometimes) trying to make the simplest
 things work in Silverlight and WPF. I’m always plugging holes, or finding
 workarounds, or searching the web for bizarre techniques or error messages.
 I’ve spent more time f***ing around than I have actually writing productive
 code in these platforms over the last 3 years. Attempting to follow the MVVM
 pattern has by far wasted the most time recently.



 Has anyone out there got a simple working example of an SL3 project where
 a Button click invokes a method in the controller? I’m at the point of
 exhaustion and wondering what else I can do in life.



 Greg



 Ps. My video card overheated at 9:30 this morning and died. I had to drive
 for an hour to get a replacement on Sunday morning. Now my left monitor has
 a quadruple sized mouse cursor that I can’t get rid of.

 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight



 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight




-- 
Miguel A. Madero Reyes
www.miguelmadero.com (blog)
m...@miguelmadero.com
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Invalid XML (addendum)

2010-08-01 Thread .net noobie
there is a code sample to download at the bottom of the blog post

On Sun, Aug 1, 2010 at 9:36 PM, Greg Keogh g...@mira.net wrote:


 http://www.cauldwell.net/patrick/blog/MVVMBindingToCommandsInSilverlight.aspx

 here is a plain/no frills example of Silverlight 3 ICommand button
 service

 very plain, no junk, just an example for how to hook up a command to a
 button in SL 3

 I downloaded the code and ran it and it worked fine for me

 OK! That's a very short article. I see he’s using RelayCommand, which I’ve
 already tried. I’ll print that off and take it to bed, and in the morning
 I’ll try it out and report what happens. Thanks for your patience with my
 impatience on this matter.

 Greg



 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Command binding working

2010-08-01 Thread Greg Keogh
Noobie, I pasted the Command.cs and ButtonBase.cs from Patrick Cauldwell's
sample project the into my project and it's working.

 

Thanks for finding that.

 

My previous attempts have used different combinations and versions of these
classes without success. This combination does look subtly different to any
of my previous attempts. Patrick's code is more primitive than some of the
others, so I might try to beef it up and generalise it with the code from
other classes.

 

Oh well, my first stupid MVVM hurdle is over, now I have to deal with grid
selections, double-clicks, trees, and ComponentOne controls. I will be a
challenge to avoid code-behind for all of these cases.

 

Greg

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


RE: Command binding working

2010-08-01 Thread Carl . Scarlett
Hi Greg,

 

Don't worry too much about eliminating code behinds.  I find that's a
good guiding principle when first learning XAML based technologies (as
it forces you to change the way you think about architecting solutions),
but just because you have code behind doesn't mean you're doing it
wrong.

 

I doubt there's a hard and fast rule for no code behinds that doesn't
have a lot of exceptions.  All I can say is that once you've got some
solid practical experiences working with XAML you'll develop a sense of
when it's appropriate to use code behind and when it isn't.  It probably
comes down to whether it breaks the spirit of the model you've
architected or not, and whether you're willing to break your own rules
in specific instances under strict conditions.

 

All I can do is encourage you to continue through these frustrating
battles.  At some point I know things will start to make more sense for
you.

 

Best of luck,

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: carl.scarl...@bankwest.com.au

 

 

 

From: ozsilverlight-boun...@ozsilverlight.com
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Greg Keogh
g...@mira.net
Sent: Monday, 2 August 2010 9:55 AM
To: 'ozSilverlight' ozsilverlight@ozsilverlight.com
Subject: Command binding working

 

Noobie, I pasted the Command.cs and ButtonBase.cs from Patrick
Cauldwell's sample project the into my project and it's working.

 

Thanks for finding that.

 

My previous attempts have used different combinations and versions of
these classes without success. This combination does look subtly
different to any of my previous attempts. Patrick's code is more
primitive than some of the others, so I might try to beef it up and
generalise it with the code from other classes.

 

Oh well, my first stupid MVVM hurdle is over, now I have to deal with
grid selections, double-clicks, trees, and ComponentOne controls. I will
be a challenge to avoid code-behind for all of these cases.

 

Greg


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

___ 
ozsilverlight mailing list 
ozsilverlight@ozsilverlight.com 
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
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


RE: Command binding working

2010-08-01 Thread Greg Keogh
Don't worry too much about eliminating code behinds. 

 

Carl, I have decided that having empty code-behind is an academic exercise
in elegance that will waste a lot of my time. My policy from today on in SL
and WPF is to minimise the code-behind, but only up to the point of
comfortable effort. I have a couple of places where child controls are
dynamically loaded, try that without code-behind! Making my controls
Blendable with mock data is not so important, it's more vital that my
controllers be unit testable, and my currently model is okay in that
respect.

 

At some point I know things will start to make more sense for you.

 

Everything does make sense (generally), I'm using quite advanced techniques
in this SL project, it's just that SL is full of holes and workarounds
(ICommand, dynamic styling, globalization for example) and there are too
many conflicting tools, articles and sample code. Over the last week I've
seen 3 wildly different ways of implementing ICommand and attached
properties, and a lot of my time was wasted evaluating them all. I struggle
with catastrophic errors, security stonewalls, WCF behaviour complexity,
Blend and VS2008 XAML designer failures and assembly bloat, all of which I'd
expect in a beta product (is the beta period over yet?).

 

Cheers,

Greg

 

Ps. Carl, can you darken your font a bit ;-)

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight