重写combobox样式时,绑定texbox的text属性时,需要使用Binding,不能使用TemplateBinding如果后端获取属性失败,需要绑定时加上
UpdateSourceTrigger=PropertyChanged
完整的例子如下
<TextBox Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"/>
参考连接:c# - TemplateBinding not working for textbox text - Stack Overflow