Databinding to a method in WPF

前端 未结 5 1198
失恋的感觉
失恋的感觉 2021-02-13 13:49

I am having trouble databinding a TextBox.Text property to a object\'s method. The idea is allowing the user to write in a TextBox a file name and then

5条回答
  •  逝去的感伤
    2021-02-13 14:16

    Ok, seems like this a bug when running WPF 4.0, as can be seen in comments here.

    Woops, I was a bit hasty .. the example works perfectly as long you compile it for the 3.5 framework (in VS 2010). But if you convert it to WPF 4.0 project the method WeightOnPlanet on ObjectDataProvider is nolonger invoked on odp2 when you edit the textbox. I have tried to find any new Attributes on either the Binding or the ObjectDataProvider – but nothing has worked out so far …

    When compiling in 3.5, it works fine here.

提交回复
热议问题