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

Scheduleview resource error

4 Answers 214 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 06 Mar 2011, 11:49 PM

I am trying a simple example of using resource groups as per "Programming Telerik ScheduleVIew for WPF/Silverlight (part 1) with simple mods.
I get the following error on the lines that define the groups as below:

Error 1 Only public or internal classes can be used within markup. 'Resource' type is not public or internal. 

<telerik:RadScheduleView.GroupDescriptionsSource>
      <telerik:GroupDescriptionCollection>
          <telerik:ResourceGroupDescription ResourceType="Activity"/>
      </telerik:GroupDescriptionCollection>
  </telerik:RadScheduleView.GroupDescriptionsSource>
  <telerik:RadScheduleView.ResourceTypesSource>
      <telerik:ResourceTypeCollection>
          <telerik:ResourceType Name="Activity">  (ERROR IS HERE)
              <telerik:Resource ResourceName="Morning Meds" />
              <telerik:Resource ResourceName="Evening Meds" />
          </telerik:ResourceType>
      </telerik:ResourceTypeCollection>
  </telerik:RadScheduleView.ResourceTypesSource>


The control worked until I inserted the group code above.


Here is entire XAML
<iCare:BaseUserControl x:Class="POCAClient.Views.TodaysActivities"
                       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                       xmlns:icc="clr-namespace:POCAClient.UserControls"
                       xmlns:iCare="clr-namespace:POCAClient"
                       xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                       xmlns:local="clr-namespace:POCAClient.Views"
                        xmlns:schedule="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView"
                       mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"
                       Loaded="BaseUserControl_Loaded" >
    <iCare:BaseUserControl.Resources>
        <Style x:Key="ActivityListContainer" TargetType="{x:Type ListBoxItem}" >
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <ToggleButton Width="{Binding ActualWidth, ElementName=ItemsList}" x:Name="MainOuterToggleButton" Height="68" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}}">
                            <DockPanel DockPanel.Dock="Left" x:Name="PanelListItemBG" HorizontalAlignment="Left" Width="{Binding ActualWidth, ElementName=MainOuterToggleButton}" Height="{Binding ActualHeight,ElementName=MainOuterToggleButton}">
                                <Image x:Name="AppointmentImage" DockPanel.Dock="Left" Margin="4,4,2,3" Style="{StaticResource ListBoxItemPhotoStyle}" Source="{Binding Path=AppointmentImage}"></Image>
                                <TextBlock x:Name="StartTimeTextBlock" DockPanel.Dock="Top" Margin="6,4,2,3" TextTrimming="CharacterEllipsis" Style="{StaticResource ScrollingListItemHeaderStyle }" ToolTip="{Binding Path= Start, StringFormat= hh:mm tt}"  Text="{Binding Path= Start, StringFormat= hh:mm tt}" />
                                <TextBlock x:Name="SubjectTextBlock" DockPanel.Dock="Top" Margin="6,2,2,3" TextTrimming="CharacterEllipsis" Style="{StaticResource ScrollingListItemHeaderStyle}" ToolTip="{Binding Path= Subject}" Text="{Binding Path= Subject}" />
                            </DockPanel>
                        </ToggleButton>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="PanelListItemBG" Property="Style" Value="{StaticResource SelectedListItemDockPanel}"/>
                                <Setter TargetName="StartTimeTextBlock" Property="Style" Value="{StaticResource SelectedListItemHeaderTextBlock}" />
                                <Setter TargetName="SubjectTextBlock" Property="Style" Value="{StaticResource SelectedListItemSubHeaderTextBlock}" />
                            </Trigger>
                            <Trigger Property="IsSelected" Value="false">
                                <Setter TargetName="PanelListItemBG" Property="Style" Value="{StaticResource DeselectedListItemDockPanel}"/>
                                <Setter TargetName="StartTimeTextBlock" Property="Style" Value="{StaticResource DeselectedListItemHeaderTextBlock}" />
                                <Setter TargetName="SubjectTextBlock" Property="Style" Value="{StaticResource DeselectedListItemSubHeaderTextBlock}" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </iCare:BaseUserControl.Resources>
  
    <Border  BorderBrush="{StaticResource BorderBorderBrush}"  BorderThickness="1" 
                    Background="{StaticResource GridBodyBrush}" DockPanel.Dock="Top" Margin="5">
        <DockPanel LastChildFill="True">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="373*" MinWidth="180"  MaxWidth="520" ></ColumnDefinition>
                    <ColumnDefinition Width="415*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <DockPanel Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2">
                    <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" DockPanel.Dock="Top" Height="30" Margin="20,5,5,5" HorizontalAlignment="Left" VerticalAlignment="Center">
                        <TextBlock Style="{StaticResource PageHeaderTextBlockStyle}" Grid.ColumnSpan="2" FontSize="24" Foreground="#202C21" Text="Today is: "></TextBlock>
                        <TextBlock  x:Name="txtTodayDate" Style="{StaticResource PageHeaderTextBlockStyle}" Grid.ColumnSpan="2" Text="df sdfns dnfnsdf sdfsdf nsdfdf nsdfnsdf sdf" FontSize="24" Foreground="#202C21" DockPanel.Dock="Top"/>
                    </StackPanel>
                </DockPanel>
                <DockPanel Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,415,0" HorizontalAlignment="Left" >
                    <telerik:RadScheduleView Name="radScheduleViewToday" Width="630" AppointmentsSource="{Binding Appointments}" >
                       <telerik:RadScheduleView.GroupDescriptionsSource>
                            <telerik:GroupDescriptionCollection>
                                <telerik:ResourceGroupDescription ResourceType="Activity"/>
                            </telerik:GroupDescriptionCollection>
                        </telerik:RadScheduleView.GroupDescriptionsSource>
                        <telerik:RadScheduleView.ResourceTypesSource>
                            <telerik:ResourceTypeCollection>
                                <telerik:ResourceType Name="Activity">
                                    <telerik:Resource ResourceName="Morning Meds" />
                                    <telerik:Resource ResourceName="Evening Meds" />
                                </telerik:ResourceType>
                            </telerik:ResourceTypeCollection>
                        </telerik:RadScheduleView.ResourceTypesSource>
                        <telerik:RadScheduleView.ViewDefinitions>
                            <telerik:TimelineViewDefinition MinorTickLength="1h" MajorTickLength="2h" VisibleDays="1"/>
                        </telerik:RadScheduleView.ViewDefinitions>
                    </telerik:RadScheduleView>
                </DockPanel>
                <DockPanel Grid.Column="1" Grid.Row="1" Margin="42,0,0,0">
                    <Border BorderBrush="{StaticResource GridBorderBrush}" BorderThickness="2" Margin="3"
                Background="{StaticResource GridBodyBrush}" Width="384">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
  
                            <DockPanel LastChildFill="True" Margin="10,15,0,30" DockPanel.Dock="Left" >
                                <TextBlock x:Name="txtNotesHeader"  DockPanel.Dock="Top" Margin="3" Foreground="#0C4F95" FontSize="17" FontWeight="Bold" Text="Notes" TextWrapping="WrapWithOverflow"/>
                                <ScrollViewer DockPanel.Dock="Right" Style="{StaticResource EasyAccessScrollViewer}" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                                    <TextBlock  x:Name="txtNotes" Style="{StaticResource TextBlockStyle}" Margin="3,0,10,0" TextWrapping="WrapWithOverflow"></TextBlock>
                                </ScrollViewer>
                            </DockPanel>
                        </Grid>
                    </Border>
                </DockPanel>
            </Grid>
        </DockPanel>
    </Border>
</iCare:BaseUserControl>

4 Answers, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 14 Mar 2011, 07:22 AM
Hi Jim,

Could you try to add the namespace: schedule="clr-namespace:Telerik.Windows.Controls.ScheduleView;assembly=Telerik.Windows.Controls" or schedule="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" and try if the ResourceType and Resource will work defined with them?

Kind regards,
Pana
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Jim
Top achievements
Rank 1
answered on 14 Mar 2011, 09:55 PM
Tried both with no success.

First xmlns:schedule = "clr-namespace:Telerik.Windows.Controls.ScheduleView;assembly=Telerik.Windows.Controls"  gives message as follows:

Error 2 Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'Telerik.Windows.Controls.ScheduleView' that is not included in the assembly. C:\_DevNewScheduleMedsPlan\IcareApplicationsNewDB\POCAClient\Views\TodaysActivities.xaml 10 41 POCAClient

Second xmlns:schedule = "clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"  gives same error as my original namespace as follows:

Error 1 Only public or internal classes can be used within markup. 'Resource' type is not public or internal. C:\_DevNewScheduleMedsPlan\IcareApplicationsNewDB\POCAClient\Views\TodaysActivities.xaml 70 55 POCAClient
0
Pana
Telerik team
answered on 15 Mar 2011, 07:45 AM
Hello Jim,

I have tested the code here and it works pretty well given the dlls:
Telerik.Windows.Controls
Telerik.Windows.Data
Telerik.Windows.Controls.Input
Telerik.Windows.Controls.Navigation
Telerik.Windows.Controls.ScheduleView

Can you provide a simple application that reproduces the problem? Perhaps you are using both RadScheduler and ScheduleView or specific version of the dlls that cause the problem.

Regards,
Pana
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Ioan Crisan
Top achievements
Rank 1
answered on 23 Oct 2012, 10:18 AM
Hi Pana,

I had the same issue as Jim and your hints helped me out. The idea was not to use the
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" namespace, but a more specific xmlns:schedule="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView" namespace. The problem seems to be the fact that there are two ResourceGroupDescription classes (in my case), in the Telerik.Windows.Controls and Telerik.Windows.Controls.Scheduling namespaces.

Hope this helps.
Tags
ScheduleView
Asked by
Jim
Top achievements
Rank 1
Answers by
Pana
Telerik team
Jim
Top achievements
Rank 1
Ioan Crisan
Top achievements
Rank 1
Share this question
or