WPF TextBox Binding with Formatting

前端 未结 3 1335
借酒劲吻你
借酒劲吻你 2021-01-02 03:41

I have just upgraded our wpf application from 3.5sp1 to 4.0.

The code below we use to bind the textbox to the underlying view model. The textbox is editable.

3条回答
  •  长情又很酷
    2021-01-02 04:02

    As an update I took Jonathans suggestion and rejigged the Binding to use LostFocus instead of PropertyChanged (where appropriate - ie wherever StringFormat was also specified).

    As Jonathan said, in some cases you have to trigger binding refresh / validation manually taking this approach.

    If anyone has better approach, I would love to see it.

提交回复
热议问题