簡體   English   中英

邊框不會顯示在WPF控件中

[英]Border will not show in WPF Control

我正在嘗試以編程方式在類中設置一個派生自System.Windows.Controls.Control的邊框。

我設置BorderBrushBorderThickness屬性並確保不透明度設置為1 ,但邊框仍然不顯示。

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

ChartPanelTitleBar派生自Control 更改后台工作,所以BorderBrush也不應該工作嗎?

您應該將元素包裝在Border中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM