Using a TemplateBinding in ControlTemplate.Triggers

前端 未结 2 657
我寻月下人不归
我寻月下人不归 2021-02-07 03:16

Why does the following piece of XAML give me a XamlParseException with the (meaningless) message \"Expression type is not a valid Style value.\" at runtime?

<         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 03:42

    Binding TemplatedParent: In this line the value of the path2 is going to apply for the Text property of the TextBlock, so it runs fine.

    In TemplateBinding : Have a close look at this, The resolved value of the Max:MyControl.Bar is going to act as the resource key for the Template binding [Here the value of Bar is not an actual value, instead it s a property key name ] which doesnt exists and so it throws the error "The given key was not present in the dictionary."

提交回复
热议问题