TabHeader Template

4 posts, 0 answers
  1. bhavin patel
    bhavin patel avatar
    24 posts
    Member since:
    Jun 2005

    Posted 05 Oct 2009 Link to this post

    <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.
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 05 Oct 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. bhavin patel
    bhavin patel avatar
    24 posts
    Member since:
    Jun 2005

    Posted 06 Oct 2009 Link to this post

    What is the solution for that.How can I make TabHeader click to get fired if user click on header Text.
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 08 Oct 2009 Link to this post

    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.
Back to Top