lot of binding error in build 23566

Apr 19, 2013 at 2:43 PM
Edited Apr 19, 2013 at 2:44 PM
hello, there

I download the latest source code and ran the DataGridTestClient project in debug mode in VS2010 SP1. it generates a lot of binding errors. this happened just as the program loading up without doing anything else

there are seems two kinds:

1)

System.Windows.Data Error: 1 : Cannot create default converter to perform 'one-way' conversions between types 'System.String' and 'System.Windows.UIElement'. Consider using Converter property of Binding. BindingExpression:Path=; DataItem='String' (HashCode=1143554951); target element is 'Popup' (Name=''); target property is 'PlacementTarget' (type 'UIElement')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='FirstName' BindingExpression:Path=; DataItem='String' (HashCode=1143554951); target element is 'Popup' (Name=''); target property is 'PlacementTarget' (type 'UIElement')
System.Windows.Data Error: 1 : Cannot create default converter to perform 'one-way' conversions between types 'System.String' and 'System.Windows.UIElement'. Consider using Converter property of Binding. BindingExpression:Path=; DataItem='String' (HashCode=1143554951); target element is 'Popup' (Name=''); target property is 'PlacementTarget' (type 'UIElement')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='FirstName' BindingExpression:Path=; DataItem='String' (HashCode=1143554951); target element is 'Popup' (Name=''); target property is 'PlacementTarget' (type 'UIElement')
S

2)

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name='sumTextBlock'); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
Coordinator
Apr 19, 2013 at 3:17 PM
Hi,


Can you please help me how to see these binding errors in Visual Studio?
Apr 21, 2013 at 6:15 PM
any update on this.
Sep 3, 2013 at 4:55 AM
PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Verbose;
Sep 3, 2013 at 4:57 AM
Edited Sep 3, 2013 at 5:00 AM
I having problems with the render performance, after I set the items source, I can see how the binding errors are repeated 3 times, why is that?

I have only 20 rows with 8 columns and that takes more that 10 second with a i5 processor second generation at 3.6 Ghz.

The errors that I am seeing are:

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name='sumTextBlock'); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name='sumTextBlock'); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='' MultiBindingExpression:target element is 'TextBlock' (Name='sumTextBlock'); target property is 'Text' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. MultiBindingExpression:target element is 'TextBlock' (Name='sumTextBlock'); target property is 'Text' (type 'String')
Sep 19, 2013 at 5:30 PM
I think I may have isolated the issue. The source of the problem is in RowSummariesValueConverter.cs, within the switch section:
switch (computation)
{
    case "Count":
        value = dt.Rows[ExtendedDataGrid.Count][currentColumnName];
        currentStackPanel = stackpanel == null ? null : stackpanel.Children[ExtendedDataGrid.Count];
        return value;
(etc..)
I think the problem is that, in some cases, value can be empty instead of Null, and when empty is returned the binding system doesn't know what to do.

To solve this, I added the following code at the bottom of the class:
public static bool IsEmptyEntity<T>(T obj)
{
    foreach (var property in typeof(T).GetProperties())
        if (property.GetValue(obj, null) != null)
            return false;
    return true;
}
and I change the cases to look like:
switch (computation)
{
    case "Count":
        value = dt.Rows[ExtendedDataGrid.Count][currentColumnName];
        currentStackPanel = stackpanel == null ? null : stackpanel.Children[ExtendedDataGrid.Count];
        if (IsEmptyEntity(value) == true)
        {
            return null;
        }
        else
        {
            return value;
        }
(etc..)
There are other binding errors that show up in the output window, however this fix seemed to restore the grid performance for me.
Coordinator
Sep 19, 2013 at 7:33 PM
Hi,

I used this logic directly in case condition return value == DBNull.Value ? string.Empty : value;
Kindly take latest.
Will try to fix other binding errors too, let me know if you find any more source.

Regards,
bpoojary
Coordinator
Sep 19, 2013 at 7:45 PM
Hi,

I removed lot from from DataGrid.Generic.xaml

Now these are left.

System.Windows.Data Error: 40 : BindingExpression path error: 'FirstName' property not found on 'object' ''Object' (HashCode=19394479)'. BindingExpression:Path=FirstName; DataItem='Object' (HashCode=19394479); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'LastName' property not found on 'object' ''Object' (HashCode=19394479)'. BindingExpression:Path=LastName; DataItem='Object' (HashCode=19394479); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'RollNumber' property not found on 'object' ''Object' (HashCode=19394479)'. BindingExpression:Path=RollNumber; DataItem='Object' (HashCode=19394479); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
'WpfControlKit.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationProvider\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationProvider.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
System.Windows.Data Error: 40 : BindingExpression path error: 'GameName' property not found on 'object' ''Object' (HashCode=19394479)'. BindingExpression:Path=GameName; DataItem='Object' (HashCode=19394479); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'Creator' property not found on 'object' ''Object' (HashCode=19394479)'. BindingExpression:Path=Creator; DataItem='Object' (HashCode=19394479); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'Owner' property not found on 'object' ''Object' (HashCode=19394479)'. BindingExpression:Path=Owner; DataItem='Object' (HashCode=19394479); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'Publisher' property not found on 'object' ''Object' (HashCode=19394479)'. BindingExpression:Path=Publisher; DataItem='Object' (HashCode=19394479); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
A first chance exception of type 'System.NullReferenceException' occurred in ExtendedGrid.dll
Coordinator
Sep 19, 2013 at 8:05 PM
Hi,

I have removed all Binding Errors kindly check by taking latest.
Please find issues and suggest new things this will keep grid up-to date.

Regards,
bpoojary
Sep 20, 2013 at 3:39 PM
Thanks for your prompt changes! I have another suggestion:

Even when GroupByControlVisibility=Collapsed, it is still possible to drag a column up to the very top of the datagrid and make it group. My suggestion is to only allow grouping when the GroupByControlVisibility is Hidden or Visible, and I believe you can do this by adding the following code in ExtendedDataGrid.cs:
private void AddGroupByColumn(DataGridColumn column,bool shouldAdd)
{
    // If there is no drop target for a dragged column, don't allow grouping
    if (GroupByControlVisibility == System.Windows.Visibility.Collapsed)
    {
        return;
    }

    (continues...)
Thanks for your work on this grid!
Coordinator
Sep 20, 2013 at 8:49 PM
Thanks , Take latest and check.

Report few more issues which you find.

Regards,
bpoojary