Alex
Alex

Reputation: 732

Border will not show in WPF Control

I'm trying to programmatically set a border in class that is derived from System.Windows.Controls.Control.

I set the BorderBrush and BorderThickness properties and made sure opacity is set to 1, but the border still does not show.

_titleBar = GetTemplateChild("PART_TitleBar") as ChartPanelTitleBar;
_titleBar.Background = Brushes.Tomato;
_titleBar.BorderBrush = Brushes.Blue;
_titleBar.BorderThickness = new Thickness(1, 1, 1, 1);

ChartPanelTitleBar is derived from Control. Changing the Background works, so shouldn't the BorderBrush work too?

Upvotes: 1

Views: 1455

Answers (1)

vc 74
vc 74

Reputation: 38179

You should wrap your element in a Border

Upvotes: 4

Related Questions