Does anyone know how to create a wpf Style in code behind, I can\'t find anything on the web or MSDN docs. I have tried this but it is not working:
Style s =
This should get you what you need:
Style style = new Style { TargetType = typeof(Control) }; style.Setters.Add(new Setter(Control.ForegroundProperty, Brushes.Green)); myControl.Style = style;