Hi !
Theoretically, I think that I can define Brushes and Colors etc. in an xaml file and assign that to a button.background in c#. But how do I do that? Where do I put my lineargradientbrush definition like this:
<LinearGradientBrush x:Key="BlaBrush">
<GradientStop Offset="0" Color="Red"/>
<GradientStop Offset="1" Color="Green"/>
</LinearGradientBrush>
Just putting it at various places in my window's xaml file results in various error messages :/
I found this question here on stackoverflow: http://stackoverflow.com/questions/1248177/how-to-use-a-defined-brush-resource-in-xaml-from-c which explains a part of it, but he seems to know where to do the Brush definition.
I also tried adding the shinyblue.xaml wpf template to the app and added <ResourceDictionary Source="ShinyBlue.xaml"/>
to the application.resources in app.xaml. This makes all my buttons blue instantly, but still, the "things" defined in shinyblue.xaml like NormalBrush is not accessible from C# - at least I don't know how.
Marc