Using .NET 3.5
I have a UserControl with a LinearGradientBrush for the background.
I’m wondering how can I cause the whole control to change to a different color and pulsate when a property on the user control changes.
For example if I say MyUserControl.Prop1 = 20 then change the color to red and pulse (by pulsating I mean geting brighter then darker and toggling back and forth). Then when MyUserControl.Prop1 = 0 it returns back the original color.
I would preferably like to keep the gradient background when pusating a different color but if this isn’t possible then so be it
Any pointers or links would be great. I’ve googled this but didn’t find anything useful.
This is my UserControl
<UserControl x:Class="StatusPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Margin="11" >
<Grid>
<Border Margin="-5" BorderBrush="Black" BorderThickness="1" CornerRadius="30" >
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
<Border.Background >
<LinearGradientBrush EndPoint="0,0" StartPoint="1,1">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="Silver" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<StackPanel Orientation="Vertical">
<!-- All my user contraols defined here -->
</StackPanel>
</Grid>
</UserControl>
Can’t post comments for some reason!
Good answer Greg, thanks for that. Unfortunatly i’m using 3.5 .. forgot to mention that when I first asked the Q
this is what I did to solve it: