I am trying to handle the click event for the xamtabcontrol left and right scroll buttons. On the left or right button click I want to make the next or previous tab active, instead of the default behaviour to scroll the tab headers. Here's the xaml:
<igWindows:XamTabControl.Resources> <Style x:Key="{x:Static igWindows:XamTabControl.ScrollLeftButtonStyleKey}" TargetType="{x:Type RepeatButton}"> <EventSetter Event="Click" Handler="ScrollLeftButton_Click"/> </Style></igWindows:XamTabControl.Resources>
The click event gets fired with this, but the left button is not show completly with the left arrow, just a small blue button shows up. What am I missing?
Hello,
Look at the attached project - I made the required behaviour.
All I do is to copy/paste default style for xamTabControl from defaultStyles folder.
And edit the command the these two buttons execute(for leftScroll set xamTabControl.SelectedPreviosTab; and for rightScroll -> xamTabControl.SelectedNextTab).
If you have any question, do not hesitate to ask.
Regards,
Anastas
Thanks for the quick reply. I guess there is no other easy way then?
What I did was grabbed the contents of ScrollLeftButtonStyle and ScrollRightButtonStyle and PagerScrollButtonBase from defaultstyles folder and put them in my own xaml along with my eventtrigger. Although I think there should be a theme independent way of doing this. I grabbed the style from from office2k7black theme, but later I am going to change to use office2010 theme and I'll have to redo this code.
Anyways thanks for pointing in the right direction.
<igWindows:XamTabControl ><igWindows:XamTabControl.Resources> <Style TargetType="{x:Type RepeatButton}" x:Key="PagerScrollBtnBase"> ..... </Style> <Style x:Key="{x:Static igWindows:XamTabControl.ScrollLeftButtonStyleKey}" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource PagerScrollBtnBase}"> <Setter Property="Content" Value="M3,0L3,5 0,2.5z"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RepeatButton}"> ....... </ControlTemplate> </Setter.Value> </Setter> <EventSetter Event="Click" Handler="ScrollLeftButton_Click"/> </Style> <Style x:Key="{x:Static igWindows:XamTabControl.ScrollRightButtonStyleKey}" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource PagerScrollBtnBase}"> <Setter Property="Content" Value="M0,0L0,5 3,2.5z"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RepeatButton}"> ..... </ControlTemplate> </Setter.Value> </Setter> <EventSetter Event="Click" Handler="ScrollRightButton_Click"/> </Style></igWindows:XamTabControl.Resources>