Treeview LoadOnDemand event in ViewModel

2 posts, 0 answers
  1. Sistema PRI
    Sistema PRI avatar
    5 posts
    Member since:
    Oct 2008

    Posted 23 Sep 2013 Link to this post

    Hi,
    I want to use LoadOnDemand feature from TreeView in ViewModel.
    The problem is that if I trigger an event as Command, I get RadRoutedEventArgs as parameter, but I want only the DataItem, that is my object.
    I want to keep my ViewModel without any View object.
    How Can I do this ?

    Best Regards
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 26 Sep 2013 Link to this post

    Hi,

    It is expected that you will receive RadRoutedEventArgs as command parameter when using the Event-To-Command pattern, because the arguments of the subscribed event are sent as command parameters.

    Since this approach is not suitable in your scenario, you can subscribe to the LoadOnDemand event of the RadTreeView control and invoke a method defined in your ViewModel form the code behind file of your user control. By doing so you will be able to pass the needed business item into your ViewModel and implement your custom logic there.

    I hope that this clarifies your question.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top