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
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.
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
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.
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?
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
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!
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