I have a few styles in my App.xaml file:
A StaticResource is static. You can't change them once the application has compiled.
For this purpose, there is DynamicResource:
A DynamicResource will create a temporary expression during the initial compilation and thus defer lookup for resources until the requested resource value is actually required in order to construct an object.
Also note that you can find the reference to the other resource better using FindResource. Try something like this (full working sample):
In MainPage.xaml:
In MainPage.xaml.cs:
Style style = this.FindResource("abc") as Style;
var r = this.FindResource("styleRed");
foreach (Setter s in style.Setters)
{
if (s.Property == StackPanel.BackgroundProperty)
{
s.Value = r;
}
}