If you're using the Model-View-ViewModel (MVVM) pattern or something similar, you could make the brush colour (or the entire brush) a property of your viewmodel and bind directly to it.
In my (inexperienced) opinion, resources shouldnt change at runtime. If it's going to be changing, bind it.
(edit2: Changed from Silverlight-style top-level UserControl to WPF Window. As Ray Booysen noted in the comments, a UserControl in WPF would expose the colour via a DependencyProperty, not have it bound to a ViewModel.)
XAML:
<Grid x:Name="LayoutRoot">
<Grid.Background>
<SolidColorBrush Color="{Binding BackgroundColor}" />
</Grid.Background>
...
Viewmodel class:
public class MyViewModel : INotifyPropertyChanged
{
public Color BackgroundColor
{
get { ... }
set { ... } // fire PropertyChanged event
}
...
XAML.cs:
public partial class MyWindow : Window
{
private MyViewModel m_viewmodel;
public MyWindow()
{
InitializeComponent();
viewmodel = new MyViewModel();
this.LayoutRoot.DataContext = viewmodel;
}
private void ButtonClick(object sender, RoutedEventArgs e)
{
this.viewmodel.BackgroundColor = Color.Red;
}
...