Close button on tabs doesn't work reliably

5 posts, 0 answers
  1. Greg
    Greg avatar
    22 posts
    Member since:
    Aug 2011

    Posted 28 Nov 2012 Link to this post

    Our project uses Prism with great success. One of our Prism regions is a RadTabControl and we programmatically add and remove tabs via Prism. Each of our tabs needs to have a close button so we've defined a ClosableTabItemHeader that looks like this:

    <UserControl x:Class="Infrastructure.Controls.ClosableTabItemHeader"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 mc:Ignorable="d"
                 d:DesignHeight="300"
                 d:DesignWidth="300">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Screen.DisplayName}"
                       FontWeight="DemiBold" />
            <telerik:RadButton Width="14"
                               Height="14"
                               Margin="5,0,0,0"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Command="{Binding Screen.CloseCommand}"
                               Padding="0">
                <Image Source="pack://application:,,,/Resources;component/Glyphs/24/cross.png"
                       Height="10"
                       Width="10" />
            </telerik:RadButton>
        </StackPanel>
    </UserControl>

    Our RadTabItems use our ClosableTabItemHeader as such...

    <telerik:RadTabItem.Header>
        <Controls:ClosableTabItemHeader DataContext="{Binding}" />
    </telerik:RadTabItem.Header>

    For months this worked without any problems at all. Lately, however, we're noticing that we sometimes have to click the close button two or more times for the command to execute. We've gone over our code with a fine tooth comb and from what we can tell the bound command simply isn't being called. We're out of ideas so we're hoping that Telerik might have one or two.

    Greg
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 03 Dec 2012 Link to this post

    Hello Greg,

    I'm not sure what exactly is causing the issue in your case - can you try to isolate the issue in a sample solution so that we can test it locally? That would greatly help us in quickly narrowing down the cause for the issue and we'll be able to suggest a solution.

    Thank you in advance.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. ClausDC
    ClausDC avatar
    58 posts
    Member since:
    Feb 2010

    Posted 05 Aug 2013 Link to this post

    We have this problem, too. It's difficult to reproduce because it's quite random.

    But when it occurs it usually stays for the lifetime (but not always, maybe a hint to some kind of garbage collection problem?) of the application for every tab. In my case, when the problem occurs, I always have to click the close button exactly twice.

    I noticed that in this case, the first click starts the "pressed" animation of the button but immediately returns to the "unpressed" state of the button (and the command to close the tab isn't executed) as long as I keep the mouse button pressed which is different from the normal behaviour.
  5. ClausDC
    ClausDC avatar
    58 posts
    Member since:
    Feb 2010

    Posted 05 Aug 2013 Link to this post

    I just noticed this thread: http://www.telerik.com/community/forums/wpf/tabcontrol/button-click-event-suppressed-by-radtabcontrol.aspx

    These issues seem related.

    It even is in your bug tracking system:

    http://www.telerik.com/support/pits.aspx#/public/silverlight/9428

    I checked one tab where I got this problem pretty reliably and it has indeed a button on it with "IsDefault=true", I removed this and lo and behold, the problem disappears.

    I hope this helps with fixing the issue.
  6. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 08 Aug 2013 Link to this post

    Hello Claus,

    You are right the PITS issue is similar to the reported behavior. As it is already logged in our PITS you can follow it and vote for it. Please stay tuned for any changes to that item.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready