Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 241735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:46:42+00:00 2026-05-11T20:46:42+00:00

Here is my XAML for a TabItem. I want to be able to set

  • 0

Here is my XAML for a TabItem. I want to be able to set the Color of a single gradient stop in a trigger. I know that I can re-define the gradient completely in the trigger’s setter, but I want to access a specific property on the background so I can animate it in the future.

I have tried every variation of everything in the trigger’s setter and googled for a long time – but I still can’t get it to compile. I have also tried class.property syntax, but still nothing. The current error this code raises is:

“Type ‘Background.GradientStops[0]’ was not found.”

I am pretty sure I know what is going on here – and perhaps what I want is impossible. But there has to be a way to animate a control’s gradient in a control template…

Can anyone help me?
thanks

<Style TargetType="{x:Type TabItem}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabItem}">
                <TextBlock Padding="6 2 6 2" Name="TheHeader">
                    <TextBlock.Background>
                        <LinearGradientBrush StartPoint="0, 0" EndPoint="0, 1">
                            <GradientStop Offset="0" Color="#f4fafd" />
                            <GradientStop Offset="1" Color="#ceedfa" />
                        </LinearGradientBrush>
                    </TextBlock.Background>
                    <ContentPresenter ContentSource="Header" Margin="0" />
                </TextBlock>
                <ControlTemplate.Triggers >
                    <Trigger Property="IsSelected" Value="True">
                        <Setter TargetName="TheHeader" Property="Background.GradientStops[0].Color" Value="White" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:46:42+00:00Added an answer on May 11, 2026 at 8:46 pm

    You can animate it, like in the example here.

    You also could use a slight hack to set it, though I always prefer creating multiple brushes as resources and swapping them or re-creating a brush in the as you mentioned.

    <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <TextBlock Padding="6 2 6 2"
                                   Name="TheHeader" Tag="#f4fafd">
                                        <TextBlock.Background>
                                                <LinearGradientBrush StartPoint="0, 0"
                                                                     EndPoint="0, 1">
                                                        <GradientStop Offset="0" 
                                                                      Color="{Binding ElementName=TheHeader, Path=Tag}"/>
                                                        <GradientStop Offset="1"
                                                                      Color="#ceedfa" />
                                                </LinearGradientBrush>
                                        </TextBlock.Background>
                                        <ContentPresenter ContentSource="Header"
                                                          Margin="0" />
                        </TextBlock>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected"
                                     Value="True">
                                <Setter TargetName="TheHeader"
                                        Property="Tag"
                                        Value="Red" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the XAML structure. You'll see below that I'm subscribing to the Loaded event
So here is the XAML that I have: <ItemsControl ItemsSource={Binding Path=Groups} ItemTemplateSelector={Binding RelativeSource={RelativeSource AncestorType=Window},
Here is some xaml that displays a Stackpanel containing two Borders side by side.
I do not know what I am doing wrong here. In the XAML below,
I define DisplayHeight in my App.xaml file here: <Application.Resources> <sys:Int32 x:Key=DisplayHeight>534</sys:Int32> </Application.Resources> I try
I have problems adding panorama items through code. Here is test xaml that works.
here i am want to add accountview.xaml to the accountlistview.xaml .i am try many
Here's my Xaml for a MediaElement: <MediaElement x:Name=mediaElement Width=400 Height=300 Stretch=UniformToFill IsMuted=True> <MediaElement.Triggers> <EventTrigger
Here's my xaml <Button x:Name=btnTest Width=88 Content={Binding Value, ElementName=slSlider} Height={Binding Value, ElementName=slSlider} HorizontalAlignment=Left ></Button>
Here's my XAML code: <Window x:Class=CarFinder.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=Search for cars in TuMomo Height=480

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.