Ok, so I am starting to get a hang of WPF by now.
What I can't figure out yet is how to create a style dynamically from my .cs file. I can create the style, I can create the setters, but I can't attach the setters to the style.
Can someone please provide some working code for that?
Thank you.
Hello,
You have to add the setters in the Setters collection of the style:
Style myStyle = new Style(typeof(CellValuePresenter));
myStyle.Setters.Add(new Setter(CellValuePresenter.BackgroundProperty, Brushes.AliceBlue));
myStyle.Setters.Add(new Setter(CellValuePresenter.FontSizeProperty, 16.0));
xamDataGrid1.FieldSettings.CellValuePresenterStyle = myStyle;
Hope this helps.
Yes, it helps... somehow I could not make it work earlier...
Thanks a lot!