How bind BorderThickness in template?

孤人 提交于 2019-12-13 04:09:22

问题


I'm trying make a simple control, with a some path in it. And binding Path's Fill, Stroke and StrokeThickness properties to template's Background, BorderBrush and BorderThickness.Left.

<Path x:Name="CorePart"
   Fill="{TemplateBinding Background}"
   Stroke="{TemplateBinding BorderBrush}"
   StrokeThickness="{TemplateBinding BorderThickness.Left} 
..."

But one problem: StrokeThickness do not want to binding. Silverlight report: "The name BorderThickness does not exist in the namespace http://schemas.microsoft.com/client/2007"

How to solve this problem?


回答1:


Does your control have a BorderThickness dependency property? I don't think you can bind to a property of a property. I'd add a LeftBorderThickness dependnecy property to your control and the you could bind to that.



来源:https://stackoverflow.com/questions/1935416/how-bind-borderthickness-in-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!