RadExpander binding is broken

2 posts, 0 answers
  1. spj11
    spj11 avatar
    18 posts
    Member since:
    Jun 2011

    Posted 03 Nov 2011 Link to this post

    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?

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 08 Nov 2011 Link to this post

    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 >>

  3. DevCraft banner
Back to Top