I wanted back and forward functionality in the Breadcrumb control, this can by provided by ActionButtons. The problem with ActionButtons is that they only visually exist inside the Breadcrumb control. I wanted back/forward buttons similiar to Windows Vista's back/forward button, and visually they are outside the Breadcrumb.
Even though Actipro Breadcrumb ActionButtons use commands, the commands aren't exposed publically. To not have to re-invent the back/foward logic for my own buttons, I tied into existing functionality using the following method.
I created a couple of ActionButtons, and set their visibility to collpased so they're not visible, like this:Then I created a couple of buttons outside the BreadCrumb and databound the enabled/disabled state to the ActionButton's enabled/disable state, like this:
Finally, in the code behind for click event for the newly crated buttons, using UI automation I click the appropriate collapsed ActionButton, like this:
Of course a better solution would be if Actipro exposed the ActionButton commands, but for now this solution works, so I thought I'd share in case someone else would like similar functionality.
Even though Actipro Breadcrumb ActionButtons use commands, the commands aren't exposed publically. To not have to re-invent the back/foward logic for my own buttons, I tied into existing functionality using the following method.
I created a couple of ActionButtons, and set their visibility to collpased so they're not visible, like this:
<actipronavigation:Breadcrumb.ActionButtons>
<Button Visibility="Collapsed" x:Name="NextPageActionButton" Command="NavigationCommands.NextPage" />
<Button Visibility="Collapsed" x:Name="PreviousPageActionButton" Command="NavigationCommands.PreviousPage" />
</actipronavigation:Breadcrumb.ActionButtons>
<Button
x:Name="btnNavigatePrevious"
IsEnabled="{Binding ElementName=PreviousPageActionButton, Path=IsEnabled}"
Click="btnNavigatePrevious_Click"
>
<Button
x:Name="btnNavigateNext"
Click="btnNavigateNext_Click"
IsEnabled="{Binding ElementName=NextPageActionButton, Path=IsEnabled}"
/>
private void btnNavigateNext_Click(object sender, RoutedEventArgs e)
{
ClickAButton(NextPageActionButton);
}
private void btnNavigatePrevious_Click(object sender, RoutedEventArgs e)
{
ClickAButton(PreviousPageActionButton);
}
private static void ClickAButton(Button ButtonSource)
{
ButtonAutomationPeer peer = new ButtonAutomationPeer(ButtonSource);
IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
invokeProv.Invoke();
}