Control.BorderBrush 属性

定义

获取或设置一个用于描述控件的边框背景的画笔。

public:
 property System::Windows::Media::Brush ^ BorderBrush { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.Media.Brush BorderBrush { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.BorderBrush : System.Windows.Media.Brush with get, set
Public Property BorderBrush As Brush

属性值

Brush

用于填充控件的边框的画笔,默认值为 Transparent

属性

示例

以下示例演示如何设置控件的边框画笔属性。

<Button Name="btn6" BorderBrush="Red" 
        Click="ChangeBorderBrush">
  BorderBrush
</Button>
void ChangeBorderBrush(object sender, RoutedEventArgs e)
{
    if (btn6.BorderBrush == Brushes.Red)
    {
        btn6.BorderBrush = Brushes.Black;
        btn6.Content = "Control border brush changes from red to black.";
    }
    else
    {
        btn6.BorderBrush = Brushes.Red;
        btn6.Content = "BorderBrush";
        }
}
Private Sub ChangeBorderBrush(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    If (Equals(btn6.BorderBrush, Brushes.Red)) Then

        btn6.BorderBrush = Brushes.Black
        btn6.Content = "Control border brush changes from red to black."

    Else

        btn6.BorderBrush = Brushes.Red
        btn6.Content = "BorderBrush"
    End If
End Sub

注解

此属性仅影响模板使用 BorderBrush 属性作为参数的控件。 在其他控件上,此属性没有影响。

依赖项属性信息

标识符字段 BorderBrushProperty
元数据属性设置为 true AffectsRender, SubPropertiesDoNotAffectRender

适用于