Accessing Resources on AppointmentToolTipTemplate

2 posts, 1 answers
  1. Filipe
    Filipe avatar
    16 posts
    Member since:
    Jun 2011

    Posted 28 May 2012 Link to this post

    Hello.

    I am not able to get the resources in the appointment tooltip template.

    I am trying this way:
    <TextBlock Text="{Binding Occurrence.Appointment.Resources, Converter={StaticResource ResourcesSeparatorConverter}}" />

    But it doesn't work. It gives error :

     

    BindingExpression path error: 'Occurrence' property not found on

     

    My full code of the Appointment ToolTip Template is:

    <DataTemplate x:Key="AppointmentToolTipTemplate" >
              <Grid MaxWidth="300" >
                  <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="43" />
                      <ColumnDefinition />
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                      <RowDefinition />
                      <RowDefinition />
                      <RowDefinition />
                  </Grid.RowDefinitions>
                  <TextBlock Text="{Binding Subject}" Grid.ColumnSpan="2" TextWrapping="Wrap" Margin="5 8 4 3" FontWeight="Bold" />
                  <Image Grid.Row="1"  VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5 5 0 0" Source="/ESUX.WebPresentation.Silverlight.Activities;component/Images/clock.png" Width="28" Height="29" />
                  <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="1" Margin="0 5 0 0">
                      <StackPanel Orientation="Horizontal" Margin="0 0 0 0" >
                          <TextBlock Text="{Binding Start, StringFormat='HH:mm'}" TextWrapping="Wrap" FontSize="10" />
                          <TextBlock Text=" - " FontSize="10" />
                          <TextBlock Text="{Binding End, StringFormat='HH:mm'}" TextWrapping="Wrap" FontSize="10" />
                      </StackPanel>
                      <TextBlock Text="{Binding Start, StringFormat='{}{0:dddd (dd-MM)}'}" Margin="0 3" FontSize="10" />
                  </StackPanel>
                  <TextBlock Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Body}" Margin="5 3 5 8" TextWrapping="Wrap"  />
                  <TextBlock Text="{Binding Occurrence.Appointment.Resources, Converter={StaticResource ResourcesSeparatorConverter}}" />
              </Grid>
          </DataTemplate>

    can you help me?

    Thanks
    Filipe

  2. Answer
    Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 30 May 2012 Link to this post

    Hi Filipe,

    I see you used telerik's recommended custom tooltip code from the example, your off to a great start. To fix your problem I would start by removing the "Occurance" from Occurance.Appointment.Resource binding. I cant see the rest of your project so I cant dig any deeper, however after trying that, jump to my next paragraph.

    <TextBlock Text="{Binding Appointment.Resources, Converter={StaticResource ResourcesSeparatorConverter}}" />


    Below is the full AppointmentToolTipTemplate that telerik uses for their TV Guide RadScheduleView example, it may give you some direction with your project.
    <ControlTemplate x:Key="AppointmentToolTipTemplate" TargetType="ToolTip">
                <Border BorderBrush="#FFD6D4D4" BorderThickness="1" Background="#FFFFFFFF">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
     
                        <StackPanel Orientation="Vertical" Grid.Column="0" Margin="5">
                            <!--Subject-->
                            <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0 0 0 10">
                                <TextBlock  Text="{Binding Subject}" TextWrapping="Wrap" FontSize="18" Foreground="#FF333333" FontFamily="Segoe UI"
                               TextTrimming="WordEllipsis" MaxWidth="300" />
                                <TextBlock Text=" - LIVE" FontFamily="Segoe UI" Foreground="Red" VerticalAlignment="Center" FontSize="13" Visibility="{Binding Appointment.IsLive, Converter={StaticResource BooleanToVisibilityConverter}}" />
                            </StackPanel>
     
                            <!--Details-->
                            <StackPanel Orientation="Horizontal" Margin="0 6">
                                <!--High & Low importance marks -->
                                <Grid VerticalAlignment="Center" Margin="0">
                                    <ContentControl x:Name="HighImportanceMark" Template="{StaticResource HighImportanceMarkTemplate}" Margin="0 0 4 0"
                                Style="{StaticResource ImportanceMarkContentControlStyle}" VerticalAlignment="Top"
                                Visibility="{Binding Importance, Converter={StaticResource EnumToVisibilityConverter}, ConverterParameter=High}"   />
                                    <ContentControl x:Name="LowImportanceMark" Template="{StaticResource LowImportanceMarkTemplate}" Margin="0 0 4 0"
                                Style="{StaticResource ImportanceMarkContentControlStyle}" VerticalAlignment="Top"
                                Visibility="{Binding Importance, Converter={StaticResource EnumToVisibilityConverter}, ConverterParameter=Low}"   />
                                </Grid>                           
                                <Grid Margin="0 0 4 0" Width="10" Height="10">
                                    <Ellipse Fill="#FFA0AFC3" StrokeThickness="0"/>
                                    <Path Data="M0.49834815,0.15624278 C0.77310983,0.15624278 0.99500001,0.44771525 0.99500001,1 L0.99500001,2 C0.99500001,2.0862944 0.98956204,2.1700361 0.9793374,2.2499156 L0.97761548,2.2621038 0.99138665,2.2724657 C1.0551,2.3217192 1.1181594,2.3770881 1.1791788,2.4381075 L2.1627799,3.4035487 C2.5533043,3.7940731 2.602693,4.1590443 2.4084071,4.3533302 2.2141213,4.5476161 1.8497329,4.4976445 1.4592087,4.1071201 L0.47560761,3.1416788 C0.39018041,3.0562518 0.31582806,2.9668262 0.25382683,2.8772056 L0.23600964,2.8506927 0.21934302,2.8292158 C0.15979189,2.7483475 0.10941981,2.6422429 0.072024727,2.5185363 L0.068973461,2.5078697 0.06744724,2.5030127 0.065087656,2.4942856 0.060045546,2.4766593 C0.021751793,2.3349662 1.8765149E-09,2.1725891 0,2 L0,1 C1.8765149E-09,0.44771525 0.22358649,0.15624278 0.49834815,0.15624278 z"
                                  Fill="White" Margin="4,2,3,3" Stretch="Fill"/>
                                </Grid>
                                <TextBlock Text="{Binding Appointment.Start, StringFormat='hh:mm tt'}" FontFamily="Segoe UI" Foreground="#FF333333" FontSize="12" />
                                <TextBlock Text="-" FontFamily="Segoe UI" Foreground="#FF333333" FontSize="12"/>
                                <TextBlock Text="{Binding Appointment.End, StringFormat='hh:mm tt'}" FontFamily="Segoe UI" Foreground="#FF333333" FontSize="12" />
                            </StackPanel>
                             
                            <TextBlock Text="{Binding Appointment.Programme}" />
                        </StackPanel>
     
     
                        <Grid Grid.Column="1">
                            <!--ToolTip image -->
                            <Image Source="{Binding Appointment.ProgrammeImageSource}" Stretch="Fill" Width="117" Height="117" />
     
                            <!-- Programme Label-->
                            <Grid HorizontalAlignment="Right" VerticalAlignment="Top">
     
                                <Path Data="M210.10806,69.67952 C210.10764,68.874527 210.09457,58.371845 210.09457,58.371845 L196.33438,47.902588 L181.46046,47.913246"
                                      Fill="{Binding Appointment.LabelBrush}" HorizontalAlignment="Right" Margin="0" Stretch="Fill"
                                      Width="45.839" Height="34.873" VerticalAlignment="Top"/>
     
                                <TextBlock HorizontalAlignment="Right" Height="12" TextWrapping="Wrap" Text="{Binding Appointment.ProgrammeLabel}" VerticalAlignment="Top" Margin="0 5 6 0"
                                       FontFamily="Segoe UI" FontSize="10" RenderTransformOrigin="0.5,0.5" Foreground="White" FontWeight="Bold">
                                <TextBlock.RenderTransform>
                                    <CompositeTransform Rotation="37"/>
                                </TextBlock.RenderTransform>
                                </TextBlock>
                            </Grid>
                        </Grid>
                    </Grid>
                </Border>
            </ControlTemplate>


    Let me know if I can be of any more assistance.

    Lancelot



  3. DevCraft banner
Back to Top