Binding problem in ToolTip

4 posts, 0 answers
  1. ellic
    ellic avatar
    16 posts
    Member since:
    Oct 2011

    Posted 26 Apr 2012 Link to this post

    I'm using ToolTip Control in the RadDataBoundListBox, and the Itemtemplate is as followed:
    <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="6" Height="150" HorizontalAlignment="Left"
                                  telerikPrimitives:RadToolTipService.Style="{StaticResource HubStyle}"
                                   telerikPrimitives:RadToolTipService.ShowGesture="Tap">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="90"/>
                                    <RowDefinition Height="40"/>
                                </Grid.RowDefinitions>
                                  <telerikPrimitives:RadToolTipService.ToolTip>
                                    <StackPanel Width="230" Margin="3, 0, 0, 0">
                                        <TextBlock TextWrapping="Wrap" FontSize="23" Text="{Binding Path=screen_name}">
                                        </TextBlock>
                                        <TextBlock TextWrapping="Wrap" FontSize="23">
                                                Gender: <Run Text="{Binding gender}"/>
                                        </TextBlock>
                                        <TextBlock TextWrapping="Wrap" FontSize="23">
                                                Location: <Run Text="{Binding Path=location}"/>
                                        </TextBlock>
                                    </StackPanel>
                                </telerikPrimitives:RadToolTipService.ToolTip>
                                <Image Height="90" Width="90" Source="{Binding profile_image_url_large}">
                                    <Image.Clip>
                                        <RectangleGeometry Rect="0,0,90,90" RadiusX="3" RadiusY="3"/>
                                    </Image.Clip>
                                </Image>
                                <TextBlock Text="{Binding screen_name,Converter={StaticResource RecommandNameConverter},Mode=OneWay}"
                                           Width="90" Grid.Row="1" Margin="0,3" Foreground="{StaticResource Fanfou_Foreground}"/>
                            </Grid>
                        </DataTemplate>
                    </telerikPrimitives:RadDataBoundListBox.ItemTemplate>

    The problem is that the Binding didn't work. It's supposed that when the user tap the Grid, a ToolTip, containing the Name, Gender and Location info, will pop up.  But it didn't perform correctly.

    The Image and the last TextBolck work well, so it's not the Binding's fault.

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 26 Apr 2012 Link to this post

    Hi Ellic,

    Thank you for writing.

    There is a little quirk with the tool tip that you should be aware of. Since RadToolTip uses RadWindow to show itself above everything else, the data context of the tool tip is not same as the data context of your list box item template. The reason for this is the following: RadWindow, when opened, inserts a panel in the page's LayoutRoot. Then it puts its content (a RadToolTip instance in this case) inside this panel. Therefore, even though you declare your tool tip inside the item template, during run-time it ends up inserted inside the layout root, which is outside the item template.

    The remedy is very simple. For example, you can name your grid (the one that is inside your list box item template) to something. Then, bind the DataContext property of the stack panel in the tool tip to the grid's DataContext.
    This will be fixed in the next Q2 2012 release.

    Please write again if you have other questions.

    Regards,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. ellic
    ellic avatar
    16 posts
    Member since:
    Oct 2011

    Posted 27 Apr 2012 Link to this post

    Thanks for your reply, do you mean changing the code into
    <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="6" Height="150" HorizontalAlignment="Left"
                                  telerikPrimitives:RadToolTipService.Style="{StaticResource HubStyle}"
                                   telerikPrimitives:RadToolTipService.ShowGesture="Tap" x:Name="InerGrid">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="90"/>
                                    <RowDefinition Height="40"/>
                                </Grid.RowDefinitions>
                                  <telerikPrimitives:RadToolTipService.ToolTip>
                                    <StackPanel Width="230" Margin="3, 0, 0, 0" DataContext="{Binding DataContext,ElementName=InerGrid}">
                                        <TextBlock TextWrapping="Wrap" FontSize="23" Text="{Binding Path=screen_name}">
                                        </TextBlock>
                                        <TextBlock TextWrapping="Wrap" FontSize="23">
                                                Gender: <Run Text="{Binding gender}"/>
                                        </TextBlock>
                                        <TextBlock TextWrapping="Wrap" FontSize="23">
                                                Location: <Run Text="{Binding Path=location}"/>
                                        </TextBlock>
                                    </StackPanel>
                                </telerikPrimitives:RadToolTipService.ToolTip>
                                <Image Height="90" Width="90" Source="{Binding profile_image_url_large}">
                                    <Image.Clip>
                                        <RectangleGeometry Rect="0,0,90,90" RadiusX="3" RadiusY="3"/>
                                    </Image.Clip>
                                </Image>
                                <TextBlock Text="{Binding screen_name,Converter={StaticResource RecommandNameConverter},Mode=OneWay}"
                                           Width="90" Grid.Row="1" Margin="0,3" Foreground="{StaticResource Fanfou_Foreground}"/>
                            </Grid>
                        </DataTemplate>
                    </telerikPrimitives:RadDataBoundListBox.ItemTemplate>

    But it still doesn't work.
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 02 May 2012 Link to this post

    Hi ellic,

    Thanks for writing.
    Please download the latest internal build, it contains a fix for the tool tip that should address this issue.
    Write again if you need further assistance, we're ready to assist you.

    Greetings,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top