【发布时间】:2014-01-29 18:34:15
【问题描述】:
我想绑定 CornerRadius 值。
CornerRadius="{Binding CornerRadiusInfoBtn}"
这是TitleBar中的代码。
这是我的财产。
public CornerRadius CornerRadiusInfoBtn
{
get { return (CornerRadius)GetValue(CornerRadiusInfoBtnProperty); }
set { SetValue(CornerRadiusInfoBtnProperty, value); }
}
// Using a DependencyProperty as the backing store for CornerRadiusInfoBtn. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CornerRadiusInfoBtnProperty =
DependencyProperty.Register("CornerRadiusInfoBtn", typeof(CornerRadius), typeof(TitleBar), new PropertyMetadata(new CornerRadius(0.0,0.0,2.0,2.0)));
但是没有圆角。怎么了?
【问题讨论】:
-
圆角在哪里?它在 CornerRadius 类中吗?
-
您是否将数据上下文设置为
TitleBar的实例? -
当我将值设置为大于 0 时,角会变圆。
-
属性在类
MainWindow或TitleBar? -
对不起,我的错误,属性在标题栏中
标签: c# wpf xaml binding cornerradius