Here's the conundrum. In two different places in my application, I use a border with the exact same appearance. In an never-ending fight against code bloat and unmanageable code, I want to define the border's appearance in a style to use when I create the border. Strangely, several of the properties I set are being ignored.
Here's the code I use to create the style. Simple enough.
Style borderStyle = new Style(typeof(Border));
borderStyle.Setters.Add(new Setter(Border.BorderBrushProperty, Brushes.Black));
borderStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(4)));
borderStyle.Setters.Add(new Setter(Border.OpacityProperty, 1.0));
return borderStyle;
But when I set the style, the opacity property is left at its original value of 0.7. I have also tried setting the background of the border to a brush I created. It too is ignored.
Thanks for any insights you may have.