This is a migrated thread and some comments may be shown as answers.

Listening Breadcrumb's RadSplitButton click events

4 Answers 72 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
subash
Top achievements
Rank 1
subash asked on 05 Sep 2014, 07:58 PM
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 )


4 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 09 Sep 2014, 08:16 AM
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.
 
0
subash
Top achievements
Rank 1
answered on 09 Sep 2014, 09:44 PM
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
0
Pavel R. Pavlov
Telerik team
answered on 12 Sep 2014, 11:37 AM
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.
 
0
subash
Top achievements
Rank 1
answered on 12 Sep 2014, 04:37 PM
You really saved my day..!
It worked and thank you Pavel for the quick turnaround

Subash 
Tags
BreadCrumb
Asked by
subash
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
subash
Top achievements
Rank 1
Share this question
or