Tab Item gets disable but Disable Style Trigger does not get applied

4 posts, 0 answers
  1. Abdeali
    Abdeali avatar
    5 posts
    Member since:
    Apr 2015

    Posted 12 Jun 2015 Link to this post

    Hello,

    I am using Telerik TabControl and have several tab items under it. 

    Issue : When I set IsTabEnabled = false in VM, it disables the tabitem but does not apply the below style. The trigger seems to be not getting called when TabItem.IsEnabled Property sets to false. Please suggest.

    Thanks,

    Abdi

    TabItem Style: 

    <Style x:Key="TabItemStyle" TargetType="{x:Type telerik:RadTabItem}">       
          <Setter Property="Header" Value="{Binding TabName}" />       
          <Setter Property="IsEnabled" Value="{Binding IsTabEnabled}" />
          <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
          <Setter Property="Template">
              <Setter.Value>
                  <ControlTemplate TargetType="{x:Type telerik:RadTabItem}">
                      <Grid x:Name="wrapper">
                          <Grid.RowDefinitions>
                              <RowDefinition/>
                              <RowDefinition/>
                          </Grid.RowDefinitions>
                          <Border
                      Name="Border" Grid.Row="0"
                      Margin="0,0,4,0"
                      Background="{StaticResource TabItem_DefaultBackground}"
                      BorderBrush="{StaticResource TabItem_Border}"
                      BorderThickness="1,1,1,1"
                      CornerRadius="2,5,0,0">
                              <ContentPresenter x:Name="ContentSite"
                      VerticalAlignment="Center"
                      HorizontalAlignment="Center"
                      ContentSource="Header"
                      Margin="16,0,16,0"
                      RecognizesAccessKey="True"/>
                              <i:Interaction.Triggers>
                                  <i:EventTrigger EventName="PreviewMouseLeftButtonDown">
                                      <cmd:EventToCommand
                                          Command="{Binding DataContext.TabHeaderMouseDownCommand, Mode=OneWay,
                                          RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadTabControl}}}"
                                          PassEventArgsToCommand="True"/>
                                  </i:EventTrigger>
                              </i:Interaction.Triggers>
                          </Border>
                          <Rectangle Grid.ZIndex="1" Name="focusVisualStyle" StrokeThickness="1" Stroke="Black" StrokeDashArray="1 2" SnapsToDevicePixels="true" Visibility="Hidden" Margin="0,0,4,0"/>
                          <Border x:Name="OuterBorder" Grid.Row="1" BorderBrush="{StaticResource GenericSelItem_Border_Background}" BorderThickness="0.5,0,0,0.5" />
                      </Grid>
                      <ControlTemplate.Triggers>
                          <Trigger Property="IsSelected" Value="True">
                              <Setter Property="Panel.ZIndex" Value="100" />
                              <Setter TargetName="Border" Property="Background" Value="{StaticResource PMDarkGreen}" />
                              <Setter TargetName="Border" Property="BorderThickness" Value="1" />
                              <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PMDarkGreen}" />
                              <Setter TargetName="Border" Property="Height" Value="24" />
                              <Setter Property="Foreground" Value="{StaticResource GenericActive_Foreground}" />
                              <Setter Property="FontFamily" Value="Verdana" />
                              <Setter Property="FontSize" Value="11" />
                              <Setter Property="FontWeight" Value="Bold" />
                              <Setter Property="Opacity" Value="30" />
                          </Trigger>
                          <Trigger Property="IsSelected" Value="False">
                              <Setter Property="Foreground" Value="Black" />
                              <Setter Property="FontFamily" Value="Verdana" />
                              <Setter Property="FontSize" Value="11" />
                              <Setter Property="FontWeight" Value="Bold" />
                              <Setter Property="Opacity" Value="30" />
                              <Setter TargetName="Border" Property="Height" Value="24" />
                          </Trigger>
                          <Trigger Property="IsEnabled" Value="False">
                              <Setter TargetName="Border" Property="Background" Value="{StaticResource GenericDisabled_Background}" />
                              <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource GenericSelItem_Border_Background}" />
                              <Setter Property="Foreground" Value="{StaticResource GenericDisabled_Foreground}" />
                              <Setter TargetName="Border" Property="BorderThickness" Value="1" />
                              <Setter Property="Opacity" Value="20" />
                          </Trigger>
                          <Trigger SourceName="Border" Property="IsMouseOver" Value="True">
                              <Setter Property="Foreground" Value="{StaticResource GenericMouseOver_Foreground}" />
                              <Setter TargetName="OuterBorder" Property="Background" Value="{StaticResource GenericMouseOver_BorderBackground}" />
                              <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource GenericMouseOver_BorderBackground}" />
                              <Setter TargetName="Border" Property="Background" Value="{StaticResource GenericMouseOver_BorderBackground}" />
                          </Trigger>
                          <Trigger Property="IsFocused" Value="True">
                              <Setter TargetName="focusVisualStyle" Property="Visibility" Value="Visible"/>
                          </Trigger>
                      </ControlTemplate.Triggers>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>

  2. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 15 Jun 2015 Link to this post

    Hello Abdeali,

    I have tried to reproduce the issue on our side but with no success. The code you gave us is applied and runs as expected and the trigger is activated. Please note that this issue might be caused if the ViewModels does not notify for their property changed.

    I have attached a sample application using the your code-snippet. Simply tun the application and press the button (the second tab should become green). Please take a look and let us know if it works as expected on your side.

    Kind regards,
    Kiril Vandov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Abdeali
    Abdeali avatar
    5 posts
    Member since:
    Apr 2015

    Posted 02 Jul 2015 in reply to Kiril Vandov Link to this post

    Hello,

    Thanks for your reply.

    I noticed that the RaisePropertyChange for IsTabEnabled gets called and tab gets disabled but style for disable state (trigger) does not get rendered.

    We are actually switching between two views. So we have a legacy (VB 6.0) view and when I switch to .Net View this issue occurs. After that When I click on any other tab in .Net view, the style gets rendered and works fine.

    Please suggest what else can be the issue.

    Thanks,

    Abdi

  5. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 03 Jul 2015 Link to this post

    Hello Abdi,

    I am not sure that I understand how you are switching between VB 6.0 view and a .Net one. That is why I would like to ask you to provide us with a sample project reproducing the described behavior, and the steps we need to do in order to reproduce it.

    Looking forward to hearing from you.

    Kind regards,
    Kiril Vandov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top