User (Old forums)MemberSeptember 4, 2007 at 4:34 amPost count: 23064
Within a CellContentTemplate I’m using Bindings to attached properties.
These properties cause errors in my Trace:
System.Windows.Data Error: 12 : Cannot get ‘(prod:PageField.HasInfo)’ value (type ‘Boolean’) from ” (type ‘String’). BindingExpression:Path=(0); DataItem=’String’ (HashCode=757602046); target element is ‘TextBlock’ (Name=”); target property is ‘Text’ (type ‘String’) InvalidCastException:’System.InvalidCastException: Unable to cast object of type ‘System.String’ to type ‘System.Windows.DependencyObject’.
at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’
however, once the grid displays it all works fine.
Could it be that the DataContext for the cell is set (too) late so that the Binding is first evaluated against a false DataContext being an empty String with HashCode 757602046??
This HashCode is the same for every row!!
The error being an exception (handling of which is slow) might cause a huge performance penalty when the grid contains many rows and/or attached property bindings.
Imported from legacy forums. Posted by Nelis (had 552 views)Xceed SupportMemberSeptember 4, 2007 at 9:01 amPost count: 5658
It would appear like you are right… if you do a string.Empty.GetHashCode(), you will obtain the same value…
However, we have not seen this case before (where the DataContext of a CellContentTemplate defaults to string.Empty before actual content kicks in)…
Maybe you could try to see if setting a FallbackValue on the binding “cancels” the error (and hopefully, restores any performance degradation obtained because of the multiple binding errors).
Let me know what happens with this issue.
Imported from legacy forums. Posted by Marcus [Xceed] (had 186 views)User (Old forums)MemberSeptember 5, 2007 at 4:17 amPost count: 23064
Thnx for the quick reply
Using a FallbackValue does not make the exception trace disappear.
With respect to the performance: I did not investigate what exactly causes the problem but it usually takes several seconds for my grid (on a TabControl) to appear. Whether it is my code, the number of rows, the number of WPF controls or your control I do not know (yet).
Nevertheless this issue could probably help you improve your grid further.
Imported from legacy forums. Posted by Nelis (had 415 views)Xceed SupportMemberSeptember 5, 2007 at 8:16 amPost count: 5658
I’d definitely like to see a simple repro application for this issue…
Would it be possible to send me your code or a stripped down version of your code that reproduces the issue?
If you can, you can send it to firstname.lastname@example.org, but make sure to reference this forum post ( URL is fine )
Imported from legacy forums. Posted by Marcus [Xceed] (had 3644 views)
- You must be logged in to reply to this topic.