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

TimeSpanPicker - First Look

3 Answers 270 Views
TimeSpanPicker
This is a migrated thread and some comments may be shown as answers.
Joel Palmer
Top achievements
Rank 2
Joel Palmer asked on 09 Mar 2016, 09:30 PM

I am working through your documentation and am trying to get the 2nd TimeSpanPicker working. 

<telerik:RadTimeSpanPicker x:Name="Duration"  Value="{Binding SelectedDuration, Mode=TwoWay}"...

My implementation (different source & different name):

<telerik:RadTimeSpanPicker
    Grid.Row="1"
    x:Name="Duration" 
    Value="{Binding SelectedDuration, Mode=TwoWay}"
    StringFormat="hh\:mm' hours'"
    TimeSpanWatermarkContent="Select duration...">
    <telerik:RadTimeSpanPicker.TimeSpanComponents>
        <wpf:TimeSpanDurationComponent
            ItemsSource="{Binding Durations, Mode=OneWayToSource}"
            Header="Minutes"/>
    </telerik:RadTimeSpanPicker.TimeSpanComponents>
</telerik:RadTimeSpanPicker>

I added the DurationTimeSpanComponent (wpf.TimeSpanDurationComponent) and have the Durations collection on my MV.

However, I get this error during runtime:

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Durations; DataItem=null; target element is 'TimeSpanDurationComponent' (HashCode=46098163); target property is 'ItemsSource' (type 'IEnumerable')

Your example includes that control is a container.  Is that important? 

What I see is that you include a namespace that doesn't seem to be part of my install.  When I attempt to set this xmlns I don't have it as an option.  And, when I go to add a reference this is not part listed.  Is the documentation bad?  Is this QuickStart namespace supposed to be part of most common implementations?

xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=QuickStart.Common"

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 10 Mar 2016, 09:43 AM
Hi Joel,

The namespace is not connected with the implementation of the custom TimeSpanComponent. The observed by you error is probably connected to a wrong binding. We have created a sample project that demonstrates how to create the desired TimeSpanComponent and how the ItemsSource should be bound.

Could you please try to modify it in order to reproduce the observed by you issue and send the project back to us - thus we could be able to provide you with a prompt solution? Providing a code-snippet of your ViewModel will be also of great help.

We hope this will help you.

Regards,
Nasko
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Joel Palmer
Top achievements
Rank 2
answered on 10 Mar 2016, 10:20 PM
 Your example works and mine does not... even with copy/paste of what you gave me.  I found that my Durations collection never gets called.  Is there a requirement that the TimeSpanDurationComponent be hosted in the same project as the host control?  The binding somehow is not "right" but because it is binding it is almost impossible to debug.
0
Nasko
Telerik team
answered on 11 Mar 2016, 09:54 AM
Hello Joel,

There isn't any requirement of placing the custom TimeSpanComponent in the same project as the host control. 

Could you please, try to reproduce your issue in a sample project and send it back to us? Without being able to reproduce the issue on our side we could not tell for sure what might be the reason for the wrong binding.

We are looking forward to hearing from you.

Regards,
Nasko
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
TimeSpanPicker
Asked by
Joel Palmer
Top achievements
Rank 2
Answers by
Nasko
Telerik team
Joel Palmer
Top achievements
Rank 2
Share this question
or