Binding errors on viewDefinitions' titles

8 posts, 0 answers
  1. Thierry
    Thierry avatar
    22 posts
    Member since:
    Mar 2012

    Posted 12 Dec 2012 Link to this post

    Hello,

    I noticed some binding errors in my output window that I could not explain at first:

    System.Windows.Data Warning: 40 : BindingExpression path error: 'Title' property not found on 'object' ''String' (HashCode=1191344071)'. BindingExpression:Path=Title; DataItem='String' (HashCode=1191344071); target element is 'ContentPresenter' (Name='Content'); target property is 'ResourceKey' (type 'String')

    after some meddling around, I finally found out that what was causing those errors where the viewDefinitions in the ScheduleView object.

    it appears that I always have as many binding errors as viewDefinitions, no matter how many viewDefinitions I add to the object. So I'm guessing something is wrong with the way the viewDefinition's Title property is bound in the template. (I add "blank" viewDefinitions, with nothing set, not even the title, and I get this error. NB: the title seems to be displayed correctly, though...)

    can you confirm this? or is this something on my side that I have not understood ?
  2. Vladi
    Admin
    Vladi avatar
    749 posts

    Posted 13 Dec 2012 Link to this post

    Hi Thierry,

    This errors are caused by the way some controls are loaded in the Framework. When the application start some of the bindings get broken but shortly after that they are resolved and no exception is being thrown.

    You should worry about this errors.

    Greetings,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Thierry
    Thierry avatar
    22 posts
    Member since:
    Mar 2012

    Posted 13 Dec 2012 Link to this post

    Should I ? or should I not ?

    I cannot see what I can do to get rid of them :-/ they appear as soon as I add a viewDefinition to the RadScheduleView object
  4. Vladi
    Admin
    Vladi avatar
    749 posts

    Posted 13 Dec 2012 Link to this post

    Hello Thierry,

    I apologize for my typo, you shouldn't worry about this errors.

    If you have any other questions do not hesitate to contact us again.

    Regards,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Wetzorke
    Wetzorke avatar
    13 posts
    Member since:
    Aug 2012

    Posted 09 Nov 2016 Link to this post

    As of UI for WPF R3 2016 (2016.3.1024) the errors still occur.

    Both ViewDefinitions and Bindings do work actually, but I dislike all the error messages during runtime:

    There is a binding error at initialization for every ViewDefinition added, and a binding error for each Binding within a ViewDefinition.

    The example below results in 23 (4 ViewDefinitions + 19 bindings) error messages:

    <telerik:RadScheduleView>
        <telerik:RadScheduleView.ViewDefinitions>
            <telerik:DayViewDefinition
                MajorTickLength="{Binding MajorTickLength}"
                MinorTickLength="{Binding MinorTickLength}"
                GroupHeaderDateStringFormat="{Binding DayStringFormat}"
                TimerulerMajorTickStringFormat="{Binding MajorTickStringFormat}"
                TimerulerMinorTickStringFormat="{Binding MinorTickStringFormat}" />
            <telerik:WeekViewDefinition
                MajorTickLength="{Binding MajorTickLength}"
                MinorTickLength="{Binding MinorTickLength}"
                GroupHeaderDateStringFormat="{Binding DayStringFormat}"
                TimerulerMajorTickStringFormat="{Binding MajorTickStringFormat}"
                TimerulerMinorTickStringFormat="{Binding MinorTickStringFormat}" />
            <telerik:MonthViewDefinition
                GroupHeaderDateStringFormat="{Binding WeekStringFormat}"
                TimerulerGroupStringFormat="{Binding DayOfTheWeekStringFormat}"
                TimerulerMajorTickStringFormat="{Binding DayOfTheMonthStringFormat}" />
            <telerik:TimelineViewDefinition
                MajorTickLength="{Binding MajorTickLength}"
                MinorTickLength="{Binding MinorTickLength}"
                GroupHeaderDateStringFormat="{Binding DayStringFormat}"
                TimerulerGroupStringFormat="{Binding DateStringFormat}"
                TimerulerMajorTickStringFormat="{Binding MajorTickStringFormat}"
                TimerulerMinorTickStringFormat="{Binding MinorTickStringFormat}" />
        </telerik:RadScheduleView.ViewDefinitions>
    </telerik:RadScheduleView>

     

    Each ViewDefinition produces an error similar to:

    System.Windows.Data Warning: 40 : BindingExpression path error: 'Title' property not found on 'object' ''String' (HashCode=-846991594)'. BindingExpression:Path=Title; DataItem='String' (HashCode=-846991594); target element is 'ContentPresenter' (Name='Content'); target property is 'ResourceKey' (type 'String')

     

    Each Binding produces an error similar to:

    System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=MajorTickLength; DataItem='SchedulerViewModel' (HashCode=48258167); target element is 'DayViewDefinition' (HashCode=50575939); target property is 'MajorTickLength' (type 'ITickProvider')

     

    I would really like to see those errors disappear, so I would like to ask if those errors could be fixed in an upcoming release. Or is there a workaround or proper usage which I am not aware of?

  6. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    417 posts

    Posted 15 Nov 2016 Link to this post

    Hello Christoph,

    Indeed, the error is still present with the latest release. Though you are receiving the errors and warnings in the Output Window, they should not affect the normal flow of your application. As my colleague has previously advised, the issue is caused by the Framework control loading mechanism. I have logged a public item - Improve ViewDefinitions "Binding Warnings" behavior. We will consider if it is possible to apply some workaround or rework the behavior. I encourage you to vote for the item so that its priority is increased.

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  7. Wetzorke
    Wetzorke avatar
    13 posts
    Member since:
    Aug 2012

    Posted 27 Jan in reply to Stefan Nenchev Link to this post

    In UI for WPF R1 2017 (2017.1.117) the problem has been fixed partially:

    The binding errors for the ViewDefinition (System.Windows.Data Warning: 40) have been fixed,

    but the binding errors for each Binding within a ViewDefinition (System.Windows.Data Error: 2) have not been fixed and still occur!

  8. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    417 posts

    Posted 31 Jan Link to this post

    Hi Christoph,

    The additional binding warnings generated are expected as the ViewDefinitions of the ScheduleView inherit from the Freezable class. Please check the following article - Leveraging Freezables to Provide an Inheritance Context for Bindings. The same issue was discussed in one of the answers below the article. 

    You can avoid the warnings by explicitly pointing the Source of the Binding. For example:

    <Window.Resources>
           <local:ViewModel x:Key="MyViewModel"/>
       </Window.Resources>
     
    <telerik:RadScheduleView AppointmentsSource="{Binding Appointments}">
               <telerik:RadScheduleView.ViewDefinitions>
                   <telerik:DayViewDefinition MajorTickLength="{Binding MajorTickLength, Source={StaticResource MyViewModel}}">
                   </telerik:DayViewDefinition>
               </telerik:RadScheduleView.ViewDefinitions>
     </telerik:RadScheduleView>


    Regards,
    Stefan Nenchev
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top