WPF binding to another property's binding in a style

后端 未结 2 1595
情歌与酒
情歌与酒 2021-01-15 08:43

I\'m not sure the best way to ask this question (sorry for the ambiguous question title), but essentially I\'d like to set the MaxLength property on a TextBox using a value

2条回答
  •  时光说笑
    2021-01-15 09:12

    you can pass in lutiple properties to your converter by using a multi binding, this allows you to do a binding on as may properties as you want, and if any of the properties change (i.e. implent INotifyPropertyChanged) the binding will be reevaluated. for what you are doing you would have to use reflection to find a property on the passed in object with a particular property name that matches your converter parameter. i dont think you will end up using the code below, but it shows you can have multiple parameters to your binding in xaml. including the path, converter, converter parameter. Im not sure about the relative source but however, but i think you might need it to do what you want. have a look at debugging Data Bindings for a good way to debug. this technique is essential. i use it continually.

      
         
            
         
      
    

提交回复
热议问题