Receives binding warning in debug output

2 posts, 0 answers
  1. Tormod
    Tormod avatar
    38 posts
    Member since:
    Jul 2012

    Posted 17 Aug 2012 Link to this post

    I receive this message when binding to a graphsource for each connection in the graphsource:
    System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''SeqLink' (HashCode=58169988)'. BindingExpression:Path=Content; DataItem='SeqLink' (HashCode=58169988); target element is 'ContentPresenter' (Name=''); target property is 'Content' (type 'Object')

    Commenting out all binding in the Style for connections in xaml does not help.

    internal class SeqLink:ILink<SeqStep>
        {
            public string ConnectionSide { get; internal set; }
     
            object ILink.Source
            {
                get { return Source; }
                set { Source = (SeqStep) value; }
            }
     
            public SeqStep Target { get; set; }
     
            //Uncomment either of these to remove the runtime binding error in debug window. However, the appearance is unchanged, AFAICT.
     
            //public string Content
            //{
            //    get { return String.Empty; }
            //    set { throw new NotImplementedException("Set content was called");}
            //}
     
            //public FrameworkElement Content
            //{
            //    get { return new Button() {Height = 30,Width = 30,Content = "SampleText"}; }
            //    set { throw new NotImplementedException("Set was called"); }
            //}
     
            public SeqStep Source { get; set; }
     
            object ILink.Target
            {
                get { return Target; }
                set { Target = (SeqStep) value; }
            }
        }

    Have I done something wrong, is this a bug or is there something that I should be exposing through this property that would achieve some functionality that I fail to grasp? 
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 22 Aug 2012 Link to this post

    Hi,

     The binding seems to be resolving the correct property of source object, but still fails. I believe this is because the SeqLink class is internal. If you make it public, then it would be able to correctly find the Content property. Moreover, I would recommend using another name different than 'Content' for your property in the SeqLink class. The RadDiagramConnection already has a Content property (of type object) and there could be some ambiguity between the two properties.

    Greetings,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top