XAML
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button x:Name="Button1" Background="LightGreen" Height="50" Width="70"/>
</Grid>
</Window>
VB
Class MainWindow
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Button1.BorderBrush = Brushes.Red
Button1.BorderThickness = New Thickness(5)
End Sub
End Class
当你运行上面的代码时,你会看到;
Button1边框画笔变为红色,这是okey。
Button1的边框厚度不会变为5而不是okey。
此问题看似未解决:
答案 0 :(得分:0)
就像Erno de Weerd在评论中所说,它可能是一个模板问题。我已经被这几次烧伤了。
The answer to this question is very useful
它讨论了在控件模板中绑定时使用{TemplateBinding}表达式