Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am creating a calendar application for windows phone,So far I created a simple calendar using wpcontrols but I can not add month view , year view ,week view ,days view in wpcontrols......

It is my XAML:

XML
<Grid x:Name="ContentPanel" Background="Turquoise" Grid.Row="1" Margin="12,0,12,286">

    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <!--ColorConverter="{StaticResource ColorConverter}"-->
    <wpControls:Calendar
        x:Name="Cal"
        ColorConverter="{StaticResource ColorConverter}"
        MonthChanged="Cal_MonthChanged"
        MonthChanging="Cal_MonthChanging"
        SelectionChanged="Cal_SelectionChanged"

       CharacterSpacing="10"
        WeekNumberDisplay="WeekOfMonth" FontFamily="FrankRuehl" ShowSelectedDate="False" EnableGestures="True"

        >
        <wpControls:Calendar.Projection>
            <PlaneProjection RotationX="-5"/>
        </wpControls:Calendar.Projection>
    </wpControls:Calendar>
    <!--<wpControls:Calendar
        x:Name="Cal"/
   >-->
    <TextBlock Margin="127,50,-127,-635" Grid.Row="1" Foreground="#FFC1F904" Name="selectedDate">Selected Date</TextBlock>

</Grid>

SQL
public class ColorConverter : IDateToBrushConverter
   {

       public Brush Convert(DateTime dateTime, bool isSelected, Brush defaultValue, BrushType brushType)
       {


           if (brushType == BrushType.Background)
           {


               if ( dateTime == new DateTime(DateTime.Today.Year, DateTime.Today.Month, 21) || dateTime == new DateTime(DateTime.Today.Year, DateTime.Today.Month, 30))
               {
                   return new SolidColorBrush(Colors.Brown);
               }

               else
               {
                   return new SolidColorBrush(Colors.White);
               }

           }
           else
           {
               if (dateTime.DayOfWeek == DayOfWeek.Sunday)
                 {
                    return new SolidColorBrush(Colors.Red);
                 }
               if (dateTime.DayOfWeek == DayOfWeek.Saturday)
               {
                   return new SolidColorBrush(Colors.Blue);
               }

               if (dateTime == new DateTime(DateTime.Today.Year, DateTime.Today.Month,DateTime.Today.Day))
               {
                   return new SolidColorBrush(Colors.Orange);
               }
               else
               {
                   return new SolidColorBrush(Colors.Black);
               }
           }





       }
   }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900