Listening Breadcrumb's RadSplitButton click events

5 posts, 0 answers
  1. subash
    subash avatar
    3 posts
    Member since:
    Sep 2014

    Posted 05 Sep 2014 Link to this post

    Hi All,

    I am working on a module where RadTreeview will be sync up with Telerik Breadcrumb for a huge hierarchical data.
    Tree and Breadcrumb are bind with different model and used dependency property ( context sharing ) for sync up between the controls.
    Whenever user clicks on a tree node I'll set the breadcrumb's path with dummy child nodes since the data hierarchy is huge and to save service call for each breadcrumb items. Breadcrumb data will be populated whenever user clicks on the RadSplitButton or the  RadToggleButton associated with RadBreadcrumbBarItem. 

    Currently I am not able to listen any events from RadSplitButton or RadToggleButton. 
    Please help me if anybody implemented this. ( A sample will be really appreciated )


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

    Posted 09 Sep 2014 Link to this post

    Hello,

    In order to attach a global handler for all clicks in the RadBreadCrumb, you can use the AddHandler() method.

    this.BreadCrumb.AddHandler(RadToggleButton.ClickEvent, new RoutedEventHandler(OnToggleClick));
    In the handler itself you will be able to check the e.OriginalSource property

    private void OnToggleClick(object sender, RoutedEventArgs e)
    {
        if (e.OriginalSource is RadToggleButton)
        {
             
        }
    }
    The code inside the if statement will be triggered when the user clicks on the toggle button and you will be allowed to fetch the data.

    For your convenience I prepared sample project demonstrating this approach. Please take a look at it and let me know if you need any further assistance.

    Regards,
    Pavel R. Pavlov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. subash
    subash avatar
    3 posts
    Member since:
    Sep 2014

    Posted 09 Sep 2014 in reply to Pavel R. Pavlov Link to this post

    Hi Pavel,

    Thanks for the reply. I appreciate your time.
    I am able to add the handler and events are getting fired fine. 
    Is there any users can get the view model item associated to the RadSplitButton or RadButton
    It is required to get the associated model item to populate the children when user click on RadToggleButton. 

    Thanks again. 

    Subash
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 12 Sep 2014 Link to this post

    Hi,

    Have you tried to use the DataContext property of the RadToggleButton? Basically in data binding scenarios this is the property holding the business object.

    Please give it a try and let me know if you encounter any issues.

    if (e.OriginalSource is RadToggleButton)
    {
        var context = (e.OriginalSource as RadToggleButton).DataContext;
    }


    Regards,
    Pavel R. Pavlov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. subash
    subash avatar
    3 posts
    Member since:
    Sep 2014

    Posted 12 Sep 2014 in reply to Pavel R. Pavlov Link to this post

    You really saved my day..!
    It worked and thank you Pavel for the quick turnaround

    Subash 
Back to Top
UI for WPF is Visual Studio 2017 Ready