问题
This is a follow up to my last question (see code example there and my last comment on the accepted answer). In short, I've got a Multibinding
on a WPF DataGridTextColumn
to a (home-grown) Person
object and a CheckBox
. On several computers that I have in the office, it works as expected - the content is altered based on the state of the CheckBox
according to my object that implements the IMultiValueConverter
interface - but on all four computers tested (so far) in the field, it fails.
The failure appears to be due to a faulty binding, as the object that is passed to the IMultiValueConverter
value array has type MS.Internal.NamedObject
, which I suspect is the null data binding object, DependencyProperty.UnsetValue
(but ToString()
didn't give a clearer indication).
Ostensibly, these computers are identically provisioned, though they're not literally from a cloned image. The question I have is what aspect(s) of the hardware and/or platform might possibly lead to a different behavior of the Multibinding
? Or what can I try to further investigate the source of the problem? (Disclaimer: I'm pretty much a newbie to WPF and XAML.)
回答1:
I did a search for MS.Internal.NamedObject
and came to this post which sounds like it could be related.
The ultimate cause is a bug in the WPF 4 framework related to a virtualized control binding to an ObservableCollection, and changing the DataContext. There is some workarounds posted on the official bug report page, and the easiest solution appears to be to upgrade your version of the framework if you can.
来源:https://stackoverflow.com/questions/22536645/what-hardware-platform-difference-could-cause-an-xaml-wpf-multibinding-to-checkb