MVVM and PanelBar

2 posts, 0 answers
  1. Damon
    Damon avatar
    3 posts
    Member since:
    Jan 2009

    Posted 18 Aug 2009 Link to this post

    I have a panel bar and I am using the hierarchialdatatemplate.  I am also using an MVVM pattern.  My question is how can I set the IsSelected flag on my ViewModel with a setter property and/or trigger on mouse over so that I know which item in the panel bar is currently selected during a context menu action.  I have this working on a listview, but I cannot get it to work with the panelbar.  Any help or example would be greatly appreciated.


  2. Tihomir Petkov
    Tihomir Petkov avatar
    576 posts

    Posted 19 Aug 2009 Link to this post

    Hello Damon,

    What you can do, if I understand you correctly, is use the VisualTreeHelper.FindElementsInHostCoordinates() method when the context menu is displayed. The method returns a collection of visual elements that are rendered under the mouse cursor. You can search this collection for PanelBarItem objects and if there is one, it should be the one you are looking for. Let me know if this helps.

    Tihomir Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft R3 2016 release webinar banner
Back to Top