开发者

WPF Modal dialog dataBindings

I have a PropertyGrid which is used in a side panel of my application, and the databindings for this PropertyGrid are setup in XAML. I would like to use this same 开发者_开发问答PropertyGrid in a Modal dialog box, but when I do all changes made in the dialog box immediately affect the underlying properties. Is there an easy way to prevent the databindings from affecting the source properties until an accept button is pressed? Or is there some other way to accomplish this? I am trying to not duplicate the XAML for the PropertyGrid which is what using UpdateSourceTrigger=Explicit would require.


You can set UpdateSourceTrigger=Explicit on the bindings in question, so they won't propagate immediately. Then, when you press the accept button, wire it up to a command which calls textBox1.GetBindingExpression(TextBox.Text).UpdateSource() or similar for each piece of data you want to send back to the ViewModel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜