一个Button的模板,其中的Grid元素:
<Grid Margin="4" Background="{TemplateBinding Property=Button.Background}">
这样写,为什么报错呢?而下面这句是不报错的:
<TextBlock Text="{TemplateBinding Property=Button.Content}" />

解决方案 »

  1.   

    <TextBlock Text="{TemplateBinding Property=Button.Content}"  Background="{TemplateBinding Property=Button.Background}"  />
    这样可以吗?
      

  2.   

    Grid 是 布局容器 引用 Button的模板?
      

  3.   

    不知为什么,可以运行,运行之后,就不报错了,再次改为Button.就报错,但任然可以运行
      

  4.   

    不知为什么,可以运行,运行之后,就不报错了,再次改为Button.就报错,但任然可以运行有的时候,重启VS或者重启电脑 可以解决很多灵异事件哦
      

  5.   

    你用TemplateBinding加个Button.干什么?
    画蛇添足。