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

ItemTemplateSelector not working on WP8?

2 Answers 47 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Daniel
Top achievements
Rank 1
Daniel asked on 30 Apr 2013, 09:22 AM
Hello,

i've tried to build a calendar-app using RadCalendar and mark certain days as suggested here: http://www.telerik.com/help/windows-phone/radcalendar-features-specialdays.html

Problem is, that once the targeted OS is Windows Phone 8 the sample isn't working.
Screen: http://http//image.faltermayer.net/radcalendar.png

Saying something like: "Name SelectedDay isn't available in Namespace..."

Here is the code in the MainPage.xaml
public class SelectedDay : DataTemplateSelector
        {
            public DataTemplate SpecialTemplate
            {
                get;
                set;
            }
 
 
            public override DataTemplate SelectTemplate(object item, DependencyObject container)
            {
                CalendarButtonContentInfo info = item as CalendarButtonContentInfo;
                CalendarButton button = container as CalendarButton;
                if (!button.IsFromCurrentView) return null;
                if (info.Date == null) return null;
 
                foreach (var itemCheck in App.ViewModel.SelectedDates)
                {
                    if (itemCheck.Date == info.Date)
                    {
                        return SpecialTemplate;
                    }
                }
 
                return base.SelectTemplate(item, container);
            }
        }       


However the same code is working as soon as WP7 is the targeted OS. Any ideas whats wrong with my code?

2 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 02 May 2013, 08:25 AM
Hi Daniel,

The selector is working in WP8. We are not sure what could cause the problem in your case, but you can check our samples solution to see how the special days selector is implemented.

Check the following examples:
$Examples_WP/Calendar/WeekendDaySelector.cs
$Examples_WP/Calendar/SpecialDays.xaml/.cs

Please let us know if you still experience problems.


Regards, Valentin.Stoychev
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Daniel
Top achievements
Rank 1
answered on 02 May 2013, 10:16 AM
Oh, that's embarrasing. I just had to rebuild the solution and it worked.

But thank you for your help =)
Tags
Calendar
Asked by
Daniel
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or