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

TabHeader Template

3 Answers 106 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Bhavin
Top achievements
Rank 1
Bhavin asked on 05 Oct 2009, 04:03 PM
<TabItem.header>
<textBlock>ABC</textBlock>
</TabItem.Header>

When I am modifying Header template like this then it's not raising tab click event but when I click somewhere to end corners of tabheader.Event fires.I think It is something related with bubble events Which is not working when modifying header.

Please help me for this.

3 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 05 Oct 2009, 04:07 PM
Hello bhavin patel,

This is normal behaviour due to the fact that the TextBox is handing the events and they do not bubble to the Tab.

Sincerely yours,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Bhavin
Top achievements
Rank 1
answered on 06 Oct 2009, 07:22 PM
What is the solution for that.How can I make TabHeader click to get fired if user click on header Text.
0
Kiril Stanoev
Telerik team
answered on 08 Oct 2009, 10:47 AM
Hi Bhavin,

Imagine you have the following TabControl:

<telerikNavigation:RadTabControl>
    <telerikNavigation:RadTabItem x:Name="tabItem">
        <telerikNavigation:RadTabItem.Header>
            <TextBox Text="ABC" />
        </telerikNavigation:RadTabItem.Header>
    </telerikNavigation:RadTabItem>
</telerikNavigation:RadTabControl>

Then in the code-behind you can attach a handler for the MouseLeftButtonDown event:

public Window1()
{
    InitializeComponent();
    tabItem.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(RadTabItem_MouseLeftButtonDown), true);
}
 
private void RadTabItem_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    MessageBox.Show("TabItem clicked");
}

This way, every time you click the header, the MouseLeftButtonDown event will be fired. Give it a try and let me know if you have additional question.


Sincerely yours,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TabControl
Asked by
Bhavin
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Bhavin
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or