Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
XamDataGrid Best Practices Manual cell value binding
posted

I have a XDG set out with some standard fields, and I programmatically add hundreds or thousands of fields during runtime. XDG handles this very well with virtualization and etc. However, one problem is that it is not as simple as specifying a BindingPath because these values don't come from properties of the object, I have to manually specific the binding on each cell in the cellsinviewchanged event. I have tried binding to CVP's value, but this did not work, apparently the Value is not the actual value, but a wrapping object. Instead, I used a binding on the ValueEditor.Value property. This seems to have the desired effect. 

However, one problem with this approach is that I *must* leave virtualization on for reasonable performance, but when editors are recycled, they assign back to my objects the value NULL. So when I am scrolling the datagrid, when cells are scrolled out of view, they apply null to all nullable objects that I've bound. This is a problem for things like strings where I want to be able to assign null, just not when they scroll out of view.

For my scenario, is there a best practices approach to solving the problem?