ListBoxItem doublecllick .. get MVVM

2 posts, 0 answers
  1. ITA
    ITA avatar
    381 posts
    Member since:
    Aug 2009

    Posted 18 May 2012 Link to this post


    thank's for all xour help my listbox ist fine, but one more question. I have a EventSetter on my ListBoxItem

    <EventSetter Event="MouseDoubleClick" Handler="ListBoxItem_MouseDoubleClick"/>

    void ListBoxItem_MouseDoubleClick(object sender, RoutedEventArgs e)
        Frame pageFrame = null;
        pageFrame = helper.FindChild<Frame>(Application.Current.MainWindow, "MainFrame");
         if (pageFrame != null)
             var content = pageFrame.Content as Page;
             var targetPage = content is Trichter1 ? new KontaktDetailAnsicht(myContact) as Page : new Trichter1() as Page;

    But how do i get the ViewModel? I tried Contact myContact = e.OriginalSource as Contact, but myContact is null? How do i get Values of my doubleclicked ListboxItem as my ViewModel?

  2. George
    George avatar
    1332 posts

    Posted 28 May 2012 Link to this post

    Hello Rene,

    You could get the DataContext of the RadListBoxItem using the sender parameter - you could cast it to RadListBoxItem and get the DataContext property.

    the Telerik team

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

  3. DevCraft R3 2016 release webinar banner
Back to Top