This question is locked. New answers and comments are not allowed.
Hello.
I Have a problem with the code shown in the Telerik RadCalendar First Look (showing in the Rad Controls Silverlight 2010 q2 Demo). I like this first demo of RadCalendar and I want to use it in one of my projects (for a school). But when I try it, i get this error message.
For the C# code
For the Silverlight code (xaml code), i get this error messages
Here you can see all code of the project
Xaml Code:
The C# code :
Thank for your help.
I Have a problem with the code shown in the Telerik RadCalendar First Look (showing in the Rad Controls Silverlight 2010 q2 Demo). I like this first demo of RadCalendar and I want to use it in one of my projects (for a school). But when I try it, i get this error message.
For the C# code
- The type or namespace name 'Event' could not be found (are you missing a using directive or an assembly reference?) .
For the Silverlight code (xaml code), i get this error messages
- The type 'local:EventsCollection' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
- The type 'local:Event' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
- The type 'local:EventDayTemplateSelector' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
- The attachable property 'DefaultTemplate' was not found in type 'EventDayTemplateSelector'
- The attachable property 'EventTemplate' was not found in type 'EventDayTemplateSelector'
Here you can see all code of the project
Xaml Code:
<UserControl x:Class="Telerik.Windows.Examples.Calendar.MainPage" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:Telerik.Windows.Examples.Calendar" xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="400"> <UserControl.Resources> <LinearGradientBrush x:Key="RadHeaderBackground" EndPoint="0.499,1.802" StartPoint="0.5,0.0839999988675117"> <GradientStop Color="#FF78AED6" Offset="0.178"/> <GradientStop Color="#FF174A74" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="RadContentBorderBackground" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFF2F2F2" Offset="0"/> <GradientStop Color="#FFE1E1E1" Offset="1"/> <GradientStop Color="#FFF9F9F9" Offset="0.127"/> <GradientStop Color="#FFF9F9F9" Offset="0.8"/> </LinearGradientBrush> <LinearGradientBrush x:Key="RadColBackground" EndPoint="0.5,0.936" StartPoint="0.5,0.084"> <GradientStop Color="#FFE4E4E4" Offset="0"/> <GradientStop Color="#FFC1C1C1 " Offset="1"/> </LinearGradientBrush> <DataTemplate x:Key="EventTemplate"> <StackPanel Orientation="Vertical" Width="348" HorizontalAlignment="Left" Margin="0,8"> <TextBlock x:Name="EventDate" TextWrapping="Wrap" FontSize="11" Text="{Binding FormatedDate}" /> <TextBlock x:Name="EventCompanyBranch" TextWrapping="Wrap" FontSize="11" Text="{Binding Company}"/> <TextBlock x:Name="EventTitle" Foreground="{Binding Brush}" TextWrapping="Wrap" Margin="0,4" FontSize="13" Text="{Binding Title}" /> <TextBlock x:Name="EventDetails" TextWrapping="Wrap" Foreground="#FF666666" FontSize="11" Text="{Binding Description}" /> </StackPanel> </DataTemplate> <Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <ContentPresenter /> </ControlTemplate> </Setter.Value> </Setter> </Style> <local:EventsCollection x:Key="EventsList"> <local:Event Day="2" Title="ASP.NET AJAX or Silverlight Is The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" Brush="#FF005F9F" /> <local:Event Day="3" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" Brush="#FF7F003F" /> <local:Event Day="4" Title="Integrating WPF and WCF into Office Business Applications" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" Brush="#FF006666" /> <local:Event Day="6" Title="ASP.NET AJAX or Silverlight Is The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" Brush="#FF005F9F" /> <local:Event Day="7" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" Brush="#FF7F003F" /> <local:Event Day="8" Title="Integrating WPF and WCF into Office Business Applications" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" Brush="#FF006666" /> <local:Event Day="11" Title="ASP.NET AJAX or Silverlight Is The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" Brush="#FF005F9F" /> <local:Event Day="14" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" Brush="#FF7F003F" /> <local:Event Day="15" Title="Integrating WPF and WCF into Office Business Applications" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" Brush="#FF006666" /> <local:Event Day="11" Title="ASP.NET AJAX or Silverlight Is The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" Brush="#FF005F9F" /> <local:Event Day="14" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" Brush="#FF7F003F" /> <local:Event Day="15" Title="Integrating WPF and WCF into Office Business Applications" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" Brush="#FF006666" /> <local:Event Day="23" Title="ASP.NET AJAX or Silverlight Is The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" Brush="#FF005F9F" /> <local:Event Day="22" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" Brush="#FF7F003F" /> <local:Event Day="16" Title="Integrating WPF and WCF into Office Business Applications" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" Brush="#FF006666" /> </local:EventsCollection> <CollectionViewSource x:Key="EventsView" x:Name="EventsList" Filter="EventsList_Filter" Source="{StaticResource EventsList}" /> <local:EventDayTemplateSelector x:Key="EventDayTemplateSelector" EventsCollection="{StaticResource EventsList}"> <local:EventDayTemplateSelector.DefaultTemplate> <DataTemplate> <TextBlock Text="{Binding Text}" /> </DataTemplate> </local:EventDayTemplateSelector.DefaultTemplate> <local:EventDayTemplateSelector.EventTemplate> <DataTemplate> <TextBlock Text="{Binding Text}" Foreground="#FF000000" FontWeight="Bold" /> </DataTemplate> </local:EventDayTemplateSelector.EventTemplate> </local:EventDayTemplateSelector> </UserControl.Resources> <Grid Width="670" Height="400"> <Grid.RowDefinitions> <RowDefinition Height="45" /> <RowDefinition /> </Grid.RowDefinitions> <Border CornerRadius="5,5,0,0" Background="{StaticResource RadHeaderBackground}"> <Grid> <TextBlock Text="Upcoming Events" Foreground="#CCC2D2EF" FontSize="22" VerticalAlignment="Center" TextWrapping="Wrap" Margin="10,2,10,0" /> <TextBlock Text="Upcoming Events" Foreground="#FF00466C" FontSize="22" VerticalAlignment="Center" TextWrapping="Wrap" Margin="10,0,10,0" /> </Grid> </Border> <Border Grid.Row="1" CornerRadius="0" Background="{StaticResource RadContentBorderBackground}" BorderBrush="#FFC8C8C8" BorderThickness="1,0,1,1"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.4*" /> <ColumnDefinition Width="0.6*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="35" /> <RowDefinition /> </Grid.RowDefinitions> <Border Grid.Column="1" Grid.RowSpan="2" BorderBrush="#FFFFFFFF" BorderThickness="1,0,0,0" /> <Border Grid.Column="0" Grid.RowSpan="2" BorderBrush="#FFD4D4D4" BorderThickness="0,0,1,0" /> <Border BorderBrush="#FFBEBEBE" BorderThickness="0,0,1,0" Background="{StaticResource RadColBackground}"> <Grid> <TextBlock Text="Calendar" Foreground="#CCFFFFFF" FontSize="17" VerticalAlignment="Center" Margin="10,2,10,0" /> <TextBlock Text="Calendar" Foreground="#CC001F3F" FontSize="17" VerticalAlignment="Center" Margin="10,0,10,0" /> </Grid> </Border> <Border Grid.Column="1" BorderBrush="#FFFFFFFF" BorderThickness="1,0,0,0" Background="{StaticResource RadColBackground}"> <Grid> <TextBlock Text="Events" Foreground="#CCFFFFFF" FontSize="17" VerticalAlignment="Center" Margin="10,2,10,0" /> <TextBlock Text="Events" Foreground="#CC001F3F" FontSize="17" VerticalAlignment="Center" Margin="10,0,10,0" /> </Grid> </Border> <Border Grid.Row="1" Grid.Column="0" telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True" /> <telerik:RadCalendar x:Name="calendar" Grid.Row="1" VerticalAlignment="Top" Margin="0,15,0,0" HorizontalAlignment="Center" SelectionMode="Extended" IsTodayHighlighted="True" ViewsHeaderVisibility="Collapsed" Culture="en-US" SelectionChanged="calendar_SelectionChanged" DayTemplateSelector="{StaticResource EventDayTemplateSelector}"> </telerik:RadCalendar> <Grid Grid.Column="1" Grid.Row="1" Margin="15"> <ListBox x:Name="myEventsList" ItemContainerStyle="{StaticResource ListBoxItemStyle}" ItemsSource="{Binding Source={StaticResource EventsView}}" ItemTemplate="{StaticResource EventTemplate}" BorderBrush="{x:Null}" Background="{x:Null}" HorizontalAlignment="Left" /> <Grid x:Name="EmptyContent"> <TextBlock Text="There are no upcoming events for this date." FontStyle="Italic" FontSize="12" Foreground="#FF666666" /> </Grid> </Grid> <Border Grid.ColumnSpan="2" Grid.RowSpan="2" BorderBrush="#FFFFFFFF" BorderThickness="0.7,0,0.7,0.7" /> </Grid> </Border> </Grid></UserControl>The C# code :
using System;using System.Collections.Generic;using System.Globalization;using System.Linq;using System.Windows;using Telerik.Windows.Controls;using Telerik.Windows.Controls.Calendar;using System.Windows.Data;#if !SILVERLIGHTusing SelectionChangedEventArgs = System.Windows.Controls.SelectionChangedEventArgs;using DataTemplateSelector = System.Windows.Controls.DataTemplateSelector;#endifnamespace Telerik.Windows.Examples.Calendar{ public partial class MainPage : System.Windows.Controls.UserControl { public MainPage() { InitializeComponent(); calendar.SelectedDate = DateTime.Today; calendar_SelectionChanged(null, null); } private void calendar_SelectionChanged(object sender, SelectionChangedEventArgs e) { CollectionViewSource c = (this.Resources["EventsView"] as CollectionViewSource); c.View.Refresh(); if (c.View.IsEmpty) { this.EmptyContent.Visibility = Visibility.Visible; } else { this.EmptyContent.Visibility = Visibility.Collapsed; } } private void EventsList_Filter(object sender, System.Windows.Data.FilterEventArgs e) { Event item = e.Item as Event; e.Accepted = this.calendar != null && this.calendar.SelectedDates.Contains(item.Date); } }}Thank for your help.