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?

Answers


You should wrap your element in a Border


Need Your Help

Can you link to a good example of using BackgroundWorker without placing it on a form as a component?

c# .net multithreading backgroundworker

I can remember that many years ago (in 2005) I was using BackgroundWorker in my code without using a visual component for it, but I can't remember how (unfortunately I am very forgetful and forget

Adding fields until screen is full

blackberry user-interface

For the sake of this question, let us suppose that I want a row of buttons. I want to put as many buttons in that row as I can fit on the screen, but no more. In other words, as long as a prospective