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:
<Grid x:Name="ContentPanel" Background="Turquoise" Grid.Row="1" Margin="12,0,12,286">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<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>
<TextBlock Margin="127,50,-127,-635" Grid.Row="1" Foreground="#FFC1F904" Name="selectedDate">Selected Date</TextBlock>
</Grid>
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);
}
}
}
}