TabControl FocusBrush Setting

1 Answer 52 Views
TabControl
Justin
Top achievements
Rank 1
Justin asked on 31 May 2022, 06:37 AM | edited on 31 May 2022, 06:38 AM

Hi everyone,

I want to set the  color of the selected RadTabItem . I setted MaterialAssist.FocusBrush ,but it was not obvious. Can I set  the selected color like radiobutton in RadTabItem ,cover all the area?

 

 

Thank you!

1 Answer, 1 is accepted

Sort by
0
Vicky
Telerik team
answered on 31 May 2022, 12:23 PM

Hi Justin,

Thanks for the provided screenshots - they were of great help.

Setting the MaterialAssist.FocusBrush will take effect only for the SelectedVisual element of the RadTabItem, which by design, for the Material theme is represented by the following border:

<Border x:Name="SelectedVisual"
        BorderBrush="{TemplateBinding mat:MaterialAssist.FocusBrush}"
        BorderThickness="0 0 0 3"
        VerticalAlignment="Stretch"
        HorizontalAlignment="Stretch"
        RenderTransformOrigin="0.5 1">
    <Border.RenderTransform>
        <ScaleTransform ScaleX="0" ScaleY="1" />
    </Border.RenderTransform>
</Border>

You can either edit the default control template of the RadTabItem and modify it up to your requirements, or you can define a Style like the following to additionally change the background of the whole tab item area when the same is in its selected state:

<!--BasedOn is needed only for the NoXaml binaries-->
<Style TargetType="telerik:RadTabItem" BasedOn="{StaticResource RadTabItemStyle}">
    <Setter Property="mat:MaterialAssist.FocusBrush" Value="Red"/>
    <Style.Triggers>
        <Trigger Property="IsSelected" Value="True">
            <!--You can also bind the value to the RadTabItem's MaterialAssist.FocusBrush to keep them in sync-->
            <Setter Property="Background" Value="Red"/>
        </Trigger>
    </Style.Triggers>
</Style>

I hope you find the above suggestions helpful.

Best Regards,
Vicky
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Justin
Top achievements
Rank 1
commented on 02 Jun 2022, 02:05 AM

thank you ,it's useful! Telerik  yes!
Tags
TabControl
Asked by
Justin
Top achievements
Rank 1
Answers by
Vicky
Telerik team
Share this question
or