locked
Binding error in Output windows RRS feed

  • Question

  • I create a binding between AdminData (derived from Activity) and WorkflowItemPresenter.Item.

    <sap:WorkflowItemPresenter Margin="15" Name="inputadminData" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" HintText=\"Drop data Here\" Background="#2FFFFF00" Item=\"{Binding Path=ModelItem.AdminData\" />"

    I think that it should work
    but here is the error in the Output Window

    System.Windows.Data Error: 1 : Cannot create default converter to perform 'two-way' conversions between types 'AdminData' and 'System.Activities.Presentation.Model.ModelItem'. Consider using Converter property of Binding. BindingExpression:Path=ModelItem.adminData; DataItem='DynamicDesigner' (Name=''); target element is 'WorkflowItemPresenter' (Name='inputadminData'); target property is 'Item' (type 'ModelItem')

    Do you have any idea?

    Any help will be appreciated!


    Tuesday, March 9, 2010 11:48 AM

All replies

  • even if i write a converter:

     else if (IsOfBaseClass(value.GetType(), typeof(System.Activities.Presentation.Model.ModelItem)))
                {
                    return value as System.Activities.Presentation.Model.ModelItem;
                }

    I hope that i write it right....

    But then it requires that I must instantiate the AdminData, or else the "value" of the converter is null -> null exception is thrown.

    How can i avoid that?


               
    Tuesday, March 9, 2010 12:17 PM
  • In your xaml, you misuse  Item="{Binding Path=ModelItem.AdminData}", this binds the WorkflowItemPresenter to the AdminData property of context, instead of binding item to AdminData type.

    Please give more info about your scenario, I couldn't repro your error in my machine.

    Wednesday, March 10, 2010 6:47 AM
  • i know that, it is a mistypo when I type it in the forum post.

    [Designer(typeof(DynamicDesigner))]
        public partial class TestClass: Activity{
           
            private AdminData adminDataField;      

            public AdminData adminData {
                get {
                    return this.adminDataField;
                }
                set {
                    this.adminDataField = value;
                }
            }

    and in the DynamicDesigner:

    <sap:WorkflowItemPresenter Margin="15" Name="inputadminData" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" HintText=\"Drop data Here\" Background="#2FFFFF00" Item=\"{Binding Path=ModelItem.adminData \" />"


    and converter:

    else if (IsOfBaseClass(value.GetType(), typeof(System.Activities.Presentation.Model.ModelItem)))
                {
                    return value as System.Activities.Presentation.Model.ModelItem;
                }


    and AdminData

    public partial class AdminData : Activity {
        }

    i hope that you have enough information to repro the error.

    Waiting for your answer, i struggle with this matter weeks :((

    Wednesday, March 10, 2010 8:17 AM
  • <sap:WorkflowItemPresenter Margin="15" Name="inputadminData" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" HintText=\"Drop data Here\" Background="#2FFFFF00" Item=\"{Binding Path=ModelItem.adminData \" />"
    You never closed your { } at the Item-property (at the end).
    Nvm if I said something silly just now, I'm still new to the whole XAML / WF.
    Wednesday, March 10, 2010 10:32 AM
  • it is another typo, anyway, thank your for your post...
    Wednesday, March 10, 2010 10:43 AM
  • I create a smaller sample:

    <sap:ActivityDesigner x:Class="DummyDesigner"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
        xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation">
        <Border BorderThickness="3" CornerRadius="8" BorderBrush="#FFA2C8E5" Background="White">
            <StackPanel Orientation="Vertical">           
                <StackPanel Name="itemsDropzones" Orientation="Vertical">
                    <sap:WorkflowItemPresenter  Margin="15" Name="inputadminData" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" HintText="Drop adminData Here" Background="#2FFFFF00" Item="{Binding Path=ModelItem.adminData}" />
                </StackPanel>
            </StackPanel>
        </Border>

    </sap:ActivityDesigner>



    using System.Activities;
    using System.ComponentModel;
    namespace XYZ {

       [Designer(typeof(DummyDesigner))]
        public partial class TESTCLASS: Activity {
            public TESTCLASS()
            {
                //adminDataField = new AdminData();  <-- need this line if a converter is set!!!! Why???? Can we avoid this????
            }
            private AdminData adminDataField;

            public AdminData adminData {
                get {
                    return this.adminDataField;
                }
                set {
                    this.adminDataField = value;
                }
            }
           
         
        }
    }

    public partial class AdminData : Activity {
        }

    if you out there need anything from me, just ask ...
    Wednesday, March 10, 2010 1:32 PM
  • a sideeffect error, also in the output windows:

    System.Windows.Data Error: 40 : BindingExpression path error: 'IsCurrentLocation' property not found on 'object' ''ModelItemImpl' (HashCode=65305190)'. BindingExpression:Path=ModelItem.IsCurrentLocation; DataItem='DummyDesigner' (Name=''); target element is 'Border' (Name=''); target property is 'NoTarget' (type 'Object')
    System.Windows.Data Error: 40 : BindingExpression path error: 'IsCurrentContext' property not found on 'object' ''ModelItemImpl' (HashCode=65305190)'. BindingExpression:Path=ModelItem.IsCurrentContext; DataItem='DummyDesigner' (Name=''); target element is 'Border' (Name=''); target property is 'NoTarget' (type 'Object')
    System.Windows.Data Error: 40 : BindingExpression path error: 'IsBreakpointEnabled' property not found on 'object' ''ModelItemImpl' (HashCode=65305190)'. BindingExpression:Path=ModelItem.IsBreakpointEnabled; DataItem='DummyDesigner' (Name=''); target element is 'Border' (Name=''); target property is 'NoTarget' (type 'Object')
    System.Windows.Data Error: 40 : BindingExpression path error: 'IsBreakpointEnabled' property not found on 'object' ''ModelItemImpl' (HashCode=65305190)'. BindingExpression:Path=ModelItem.IsBreakpointEnabled; DataItem='DummyDesigner' (Name=''); target element is 'Border' (Name=''); target property is 'NoTarget' (type 'Object')
    System.Windows.Data Error: 40 : BindingExpression path error: 'IsCurrentLocation' property not found on 'object' ''ModelItemImpl' (HashCode=65305190)'. BindingExpression:Path=ModelItem.IsCurrentLocation; DataItem='DummyDesigner' (Name=''); target element is 'Rectangle' (Name=''); target property is 'NoTarget' (type 'Object')
    System.Windows.Data Error: 40 : BindingExpression path error: 'IsCurrentContext' property not found on 'object' ''ModelItemImpl' (HashCode=65305190)'. BindingExpression:Path=ModelItem.IsCurrentContext; DataItem='DummyDesigner' (Name=''); target element is 'Rectangle' (Name=''); target property is 'NoTarget' (type 'Object')
    Wednesday, March 10, 2010 1:34 PM
  • The TESTCLASS code you posted works fine for me, even without uncommenting adminDataField - that is, I can actually drag/drop the activity into a workflow item presenter, and everything works. Does all this work for you too?

    Is your question why doesn't drag+drop work?
    Or is your question 'why do I get this noisy error message in the window when the TESTCLASS is created?' 
    I also see the warnings in the output window, but I think they can be ignored.
    Wednesday, March 10, 2010 10:22 PM
  • hi tilowell,

    did you see the error: System.Windows.Data Error: 1 : Cannot create default converter to perform 'two-way' conversions between types 'AdminData' and 'System.Activities.Presentation.Model.ModelItem'. Consider using Converter property of Binding. BindingExpression:Path=ModelItem.adminData; DataItem='DynamicDesigner' (Name=''); target element is 'WorkflowItemPresenter' (Name='inputadminData'); target property is 'Item' (type 'ModelItem')

    ????

    It works fine, yes, but without binding for me.

    Could you please check that, does binding work for you?
    Thursday, March 11, 2010 7:52 AM
  • I'm getting the same error in my project. Did you solve it?
    Thursday, March 11, 2010 9:39 AM
  • i am trying to solve it, not yet until now :(
    Thursday, March 11, 2010 10:12 AM
  • if s.o. can answer this

            public TESTCLASS()
            {
                //adminDataField = new AdminData();  <-- need this line if a converter is set!!!! Why???? Can we avoid this????
            }

    it is also very helpful...
    Thursday, March 11, 2010 10:27 AM
  • I'm still not clear if people are just worrying about the error message or if there is some other problem.
    Please assume that the error message can be ignored.
    If there is some other issue (functional issue), please describe the other symptoms.
    Tim
    Tuesday, March 16, 2010 9:48 PM
  • I think this is about the error messages that appear in our output box. my question is, is there any possibility that this errors will cause a problems to the functionality of the program? 
    Tuesday, September 3, 2013 4:03 AM