My app.xaml:
<Application.Resources>
<RadialGradientBrush x:Key="myBrush">
<GradientStop Color="#FFC44EC4" Offset="0" />
<GradientStop Color="#FF829CEB" Offset="1" />
<GradientStop Color="#FF793879" Offset="0.669" />
</RadialGradientBrush>
</Application.Resources>
Here I’m trying to use it:
private void btnOK_Click(object sender, RoutedEventArgs e)
{
RadialGradientBrush b = (RadialGradientBrush)Resources["myBrush"];
//b.GradientStops[1] = new GradientStop(Colors.Red,0.0);
}
But I can’t use “b” cause it is null after defining. How can I get that resource?
You’re ‘drawing’ from the control’s resources, try one of these instead…
hope this helps