This is a migrated thread and some comments may be shown as answers.

RadExpander binding is broken

1 Answer 42 Views
Expander
This is a migrated thread and some comments may be shown as answers.
spj11
Top achievements
Rank 1
spj11 asked on 03 Nov 2011, 11:35 PM
I have binded RadExpander to an ICommand implemetation in my VM

<telerik:RadExpander Grid.Row="0" x:Name="radExpander" Collapsed="{Binding TreeUpdatedCommand}" 

This breaks with the following exception:

{System.ArgumentException: Object of type 'System.Windows.Data.Binding' cannot be converted to type 'Telerik.Windows.RadRoutedEventHandler'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at MS.Internal.XamlMemberInfo.SetValue(Object target, Object value)
   at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj, XamlPropertyToken inProperty, XamlQualifiedObject& inValue)}

Can you tell me if this is supported?

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 08 Nov 2011, 02:32 PM
Hi Spj11,

 You cannot bind command to event directly. You can use MVVM Light ToolKit and its EventToCommandbehavior which allows you to bind an event to ICommand in XAML. Please let us know if you need further assistance on this.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Expander
Asked by
spj11
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or