Thanks!! :-D
Additional tip:
I was trying to get a value from the command source:
I.e. I have a color picker, I want it to be initialized to the current color
of the SetColorCommand target.
There is no way to do that!
But... little trick....
ICommand.CanExecute(object obj) take any object as argument.
I used something like:
public class CommandCanExecuteArg
{
object val;
public CommandCanExecuteArg(object val)
{
this.val = val;
}
public object Parameter { get { return val; } }
public object ReturnValue { get; set; }
}
and I pass an instance of it to CanExecute(), this way the
SetColorCommandTarget can return its current color in ReturnValue
--
Regards,
Lloyd Dupont
NovaMind Software
Mind Mapping at its best
www.nova-mind.com
"Radek Cerny" <radekcerny@nospam.optusnet.com.au> wrote in message
news:O8ZpNDRuHHA.3368@TK2MSFTNGP02.phx.gbl...
> Well done!
>
> I am playing in the same area and am sure to have come across this soon.
>
> Thanks.
>
> "Lloyd Dupont" <net.galador@ld> wrote in message
> news:eX9XTzHuHHA.1672@TK2MSFTNGP06.phx.gbl...
>> found it!
>>
>> it's quite tricky, I remember read about it in a blog 6 month ago but
>> it's
>> nowhere in the documentation!!!
>>
>> RoutedCommand.CanExecuteChanged strore the event handlers as
>> WeakReference.
>> Therefore you have to hold a reference to the handlers your self if you
>> want
>> your event handler to be called....
>>
>
>