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

radcalender control problem

7 Answers 131 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
sonam
Top achievements
Rank 1
sonam asked on 08 Apr 2011, 11:23 AM

 

hello Telerik,
 i am using RadCalender control. and i want to implement a scenario. in my scenario i have to show some special dates for a month highlighted.
for example i want to highlight all those dates in a perticular month on which meetings are scheduled, or those dates on which holidays 
 are falling.
pls suggest me the way to implement it in silverlight.

7 Answers, 1 is accepted

Sort by
0
sonam
Top achievements
Rank 1
answered on 08 Apr 2011, 12:48 PM
hello telerik,
pls do reply soon , i am waiting..its realy very urgent!!!
0
Yana
Telerik team
answered on 11 Apr 2011, 12:17 PM
Hi sonam,

You should  use DayTemplateSelector in order to apply different style to the special days. I've attached an example to demonstrate the approach.

Hope this helps.

Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sonam
Top achievements
Rank 1
answered on 13 Apr 2011, 10:50 AM
hello Telerik,
thanks a lot for answering it...
i have implemented my problem in the same way u have suggested.. and it's working well with radcalender.
but when i tried it in raddatepicker , nothing is getting highlighted.
my xaml for raddatepicker is-
<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="datepickerexp.MainPage"
    xmlns:local="clr-namespace:datepickerexp"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
  <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <local:CustomTemplateSelector x:Key="CustomTemplateSelector">
                <local:CustomTemplateSelector.SpecialTemplate>
            <DataTemplate>
            <TextBlock Text="{Binding Text}" Foreground="Red" FontWeight="Bold" />
        </DataTemplate>
                </local:CustomTemplateSelector.SpecialTemplate>
            </local:CustomTemplateSelector>
              
        </Grid.Resources>
        <telerik:RadDatePicker x:Name="dpAsofDate" 
                               Grid.Row="0"
                               DayTemplate="{x:Null}"
                               Grid.Column="4" 
                               Grid.ColumnSpan="3" 
                               Width="100" Height="25" 
                               HorizontalAlignment="Left"
                               DateSelectionMode="Day" 
                               IsDropDownOpen="True"
                               DayTemplateSelector="{StaticResource CustomTemplateSelector}">
            <telerik:RadDatePicker.CalendarStyle>
                <Style TargetType="telerik:RadCalendar"/>    </telerik:RadDatePicker.CalendarStyle>
        </telerik:RadDatePicker>
           </Grid>
</UserControl>

and my CustomTemplateSelector.cs is-
namespace datepickerexp
{
    public class CustomTemplateSelector : DataTemplateSelector
    {
        public DataTemplate SpecialTemplate
        {
            get;
            set;
        }
  
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            List<DateTime> lsdate = GetDate();
            CalendarButtonContent content = item as CalendarButtonContent;
            if (content != null)
            {
                 
                foreach (DateTime dt in lsdate)
                {
                    if (content.Date.Day == dt.Day && content.Date.Month == dt.Month && content.Date.Year == dt.Year)
                    {
                        return this.SpecialTemplate;
  
                    }
                }
            }
            return base.SelectTemplate(item, container);
        }
        public List<DateTime> GetDate()
        {
            List<DateTime> lsdateTime = new List<DateTime>();
            lsdateTime.Add(DateTime.Today.Date);
            DateTime dt = new DateTime(2011, 04, 17);
            DateTime dt1 = new DateTime(2011, 04, 15);
            DateTime dt2 = new DateTime(2011, 05, 26);
            lsdateTime.Add(dt); lsdateTime.Add(dt1); lsdateTime.Add(dt2);
            return lsdateTime;
  
        }
    }
}
please look after the issue as soon as possible..thanks in advance!!!

0
Yana
Telerik team
answered on 14 Apr 2011, 11:40 AM
Hi sonam,

You should set the CustomTemplateSelector like this:

<Grid x:Name="LayoutRoot"  Background="White">
    <Grid.Resources>
        <local:CustomTemplateSelector x:Key="CustomTemplateSelector">
            <local:CustomTemplateSelector.SpecialTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Text}" Foreground="Red" FontWeight="Bold" />
                </DataTemplate>
            </local:CustomTemplateSelector.SpecialTemplate>
        </local:CustomTemplateSelector>
 
    </Grid.Resources>
    <telerik:RadDatePicker x:Name="dpAsofDate"
                            Grid.Row="0"                            
                            Grid.Column="4"
                            Grid.ColumnSpan="3"
                            Width="100" Height="25"
                            HorizontalAlignment="Left"
                            DateSelectionMode="Day"
                            IsDropDownOpen="True" >
        <telerik:RadDatePicker.CalendarStyle>
            <Style TargetType="telerik:RadCalendar">
                <Setter Property="DayTemplateSelector" Value="{StaticResource CustomTemplateSelector}" />
            </Style>
        </telerik:RadDatePicker.CalendarStyle>
    </telerik:RadDatePicker>
</Grid>

Try it and let us know the result.

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sonam
Top achievements
Rank 1
answered on 15 Apr 2011, 06:42 AM
Hi Telerik,
 yes your solution is working well ..but i need some more help in it.
actualy when the calender appear on clicking the raddatepicker ,a vertical column is also appeared which is highlighted by default .i want to disappear it..
how can i acheive it?
0
Yana
Telerik team
answered on 15 Apr 2011, 02:56 PM
Hi sonam,

Could you please clarify which vertical column you mean? If it's the week number column, it can be easily removed like this:

<telerik:RadDatePicker>
    <telerik:RadDatePicker.CalendarStyle>
        <Style TargetType="telerik:RadCalendar">
            <Setter Property="DayTemplateSelector" Value="{StaticResource CustomTemplateSelector}" />
            <Setter Property="AreWeekNumbersVisible" Value="False" />
        </Style>
    </telerik:RadDatePicker.CalendarStyle>
</telerik:RadDatePicker>


Best wishes,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anup
Top achievements
Rank 2
answered on 10 May 2013, 12:04 PM
Hello Telerik,


I have a scenario where I want to Book a Day and it should change accordingly...
can you please help on this...as soon as possible.

Regards,
Anup Shah. 
Tags
Calendar
Asked by
sonam
Top achievements
Rank 1
Answers by
sonam
Top achievements
Rank 1
Yana
Telerik team
Anup
Top achievements
Rank 2
Share this question
or