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 6660025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:06:13+00:00 2026-05-26T02:06:13+00:00

I have a DataTemplate with a number of layered text and graphic objects. One

  • 0

I have a DataTemplate with a number of layered text and graphic objects. One of them is a glow effect that comes from the RadialGradientBrush Fill property of a Rectangle. At first, I named the Rectangle and bound to the Fill property and changed it using a DataTrigger. This worked fine, but I have a number of RadialGradientBrush objects in the Resources section and as you can see below, it is a lot to repeat when all I want to do is change the GradientStops. So I removed the Fill binding and added and named a RadialGradientBrush and although I can bind to the brush from Resources, I can’t access it in the DataTrigger. I get the ‘Cannot find Trigger target’ error.

<Rectangle x:Name="Glow" IsHitTestVisible="False" RadiusX="1.5" RadiusY="1.5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" StrokeThickness="0" Opacity="1.0">
    <Rectangle.Fill>
        <RadialGradientBrush x:Name="GlowGradient" Center="0.5,0.848" GradientOrigin="0.5,0.818" RadiusX="-1.424" RadiusY="-0.622" GradientStops="{StaticResource DefaultGradient}">
            <RadialGradientBrush.RelativeTransform>
                <TransformGroup>
                    <ScaleTransform CenterX="0.5" CenterY="0.848" ScaleX="1" ScaleY="1.8"/>
                    <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.848"/>
                    <RotateTransform Angle="-33.418" CenterX="0.5" CenterY="0.848"/>
                    <TranslateTransform Y="0.278"/>
                </TransformGroup>
            </RadialGradientBrush.RelativeTransform>
        </RadialGradientBrush>
    </Rectangle.Fill>
</Rectangle>

In the resources, I have several RadialGradientBrush objects like this one.

<RadialGradientBrush x:Key="EscalatedGlow" Center="0.5,0.848" GradientOrigin="0.5,0.818" RadiusX="-1.424" RadiusY="-0.622">
    <RadialGradientBrush.RelativeTransform>
        <TransformGroup>
            <ScaleTransform CenterX="0.5" CenterY="0.848" ScaleX="1" ScaleY="1.8"/>
            <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.848"/>
            <RotateTransform Angle="-33.418" CenterX="0.5" CenterY="0.848"/>
            <TranslateTransform Y="0.278"/>
        </TransformGroup>
    </RadialGradientBrush.RelativeTransform>
    <GradientStop Color="Aqua" Offset="0.168"/>
    <GradientStop Color="#5E1D96FF" Offset="0.474"/>
    <GradientStop Color="#1101FFFF" Offset="1"/>
</RadialGradientBrush>

I want to replace them with less code for each colour change, so I created some GradientStopCollection objects in the Resources to replace them with.

<GradientStopCollection x:Key="EscalatedGradient">
    <GradientStop Color="Aqua" Offset="0.168"/>
    <GradientStop Color="#5E1D96FF" Offset="0.474"/>
    <GradientStop Color="#1101FFFF" Offset="1"/>
</GradientStopCollection>

Although I can bind to the Resource gradients, the problem is that I can’t access the GlowGradient brush to change its GradientStops property. I could previously access the Glow Rectangle using a DataTrigger with the following.

<DataTrigger Binding="{Binding Path=Status}" Value="Escalated">
    <Setter TargetName="Glow" Property="Fill" Value="{StaticResource EscalatedGlow}"/>
</DataTrigger>

When I use the following, I get the ‘Cannot find Trigger target’ error.

<DataTrigger Binding="{Binding Path=Status}" Value="Escalated">
        <Setter TargetName="GlowGradient" Property="GradientStops" Value="{StaticResource EscalatedGradient}"/>
</DataTrigger>

I’m thinking there just has to be a way to save me from replicating the whole RadialGraientBrush each time I want to change the colours. Is there any way to access the Rectangle Fill brush from the DataTrigger? Any tips anyone? Thanks in advance.

  • 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-26T02:06:14+00:00Added an answer on May 26, 2026 at 2:06 am

    In the end, I went with the following code:

    <Rectangle Name="Glow" IsHitTestVisible="False" RadiusX="2.5" RadiusY="2.5" 
    Fill="{StaticResource OrangeGlow}" />
    
    <Storyboard x:Key="GlowColourStoryboard" TargetName="Glow" Duration="0:0:1.5" 
    AutoReverse="True" BeginTime="0:0:0" RepeatBehavior="Forever">
        <ColorAnimation Storyboard.TargetProperty="Fill.GradientStops[0].Color" 
    To="{StaticResource RedGradient.Colour1}" />
        <ColorAnimation Storyboard.TargetProperty="Fill.GradientStops[1].Color" 
    To="{StaticResource RedGradient.Colour2}" />
        <ColorAnimation Storyboard.TargetProperty="Fill.GradientStops[2].Color" 
    To="{StaticResource RedGradient.Colour3}" />
    </Storyboard>
    

    I haven’t shown the Brush resources because… well you can make your own. This Storyboard is used in the following way and works as required:

    <DataTrigger.EnterActions>
        <BeginStoryboard Storyboard="{StaticResource GlowColourStoryboard}" />
    </DataTrigger.EnterActions>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ItemsControl with DataTemplate that looks like this: I want to achieve effect
I have a listbox with a datatemplate that holds a number of controls bound
Ok I have a ListView that has 2 GridViewColumns one displaying a number and
I have a ListBox that contains a number of User items that are DataTemplate
I have a DataTemplate within my Window's Resources section that creates a TextBlock with
I have a DataTemplate that is used by a listbox: <local:BooleanToFontColorConverter x:Key=boolToFontColor /> <DataTemplate
I have the following DataTemplate : <DataTemplate x:Key=ColoringLabels> <TextBlock Padding=0 Margin=0 Name=Username Text={Binding Username}
Hi I have a datagrid that has a number of datagridtemplate columns that are
I have a DataTemplate that is bound to a buisness class, it also contains
I have a datagrid that displays items with two columns of text row data

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.