This is a migrated thread and some comments may be shown as answers.

Binding errors on viewDefinitions' titles

7 Answers 161 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 12 Dec 2012, 01:59 PM
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 ?

7 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 13 Dec 2012, 12:01 PM
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.

0
Michel
Top achievements
Rank 1
answered on 13 Dec 2012, 03:13 PM
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
0
Vladi
Telerik team
answered on 13 Dec 2012, 03:27 PM
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.

0
Wetzorke
Top achievements
Rank 1
answered on 09 Nov 2016, 04:00 PM

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?

0
Stefan Nenchev
Telerik team
answered on 15 Nov 2016, 10:31 AM
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!
0
Wetzorke
Top achievements
Rank 1
answered on 27 Jan 2017, 02:52 PM

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!

0
Stefan Nenchev
Telerik team
answered on 31 Jan 2017, 02:11 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ScheduleView
Asked by
Michel
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Michel
Top achievements
Rank 1
Wetzorke
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or