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

NullReferenceException when ToolTip used in popup

1 Answer 107 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tony
Top achievements
Rank 1
Tony asked on 07 Feb 2013, 07:53 AM

Hi,
I am having crash problems using ToolTip in popups.. I have successfully used it elsewhere but inside popup's there seems to be a problem of some sort - (apparently) related to position information of the ToolTip used. 

I would appreciate workaround for this or guidance if I am just doing something wrong.. :)

Please find problem debugging and recreation instructions below,
Thanks,
  Tony
------------------------------------------------------------- 

Stacktrace:
   at Telerik.Windows.Controls.RadToolTip.SetPosition(Size toolTipSize)
   at Telerik.Windows.Controls.RadToolTip.<.ctor>b__0()
   at Telerik.Windows.Controls.RadWindow.CanvasLayoutUpdated(Object sender, EventArgs e)
   at System.Windows.FrameworkElement.OnLayoutUpdated(Object sender, EventArgs e)
   at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)

Problem recreation:
  1. Create new project, where on MainPage there is one image with ToolTip plus a button will open a new popup with a usercontrol containing another image with ToolTip:
  2. Run app, test ToolTip on MainPage by tapping the image and observe it working ok
  3. Click the button on MainPage and popup opens
  4. Tap image on the popup to see the ToolTip-> Crash

MAINPAGE XAML:

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <StackPanel>
        <StackPanel>
            <Image HorizontalAlignment="Center" Height="100" VerticalAlignment="Center" Width="100" Source="/ApplicationIcon.png" Margin="0,200,0,0" telerikPrimitives:RadToolTipService.ShowGesture="Tap" telerikPrimitives:RadToolTipService.ToolTip="yeehaw"  ></Image>
        </StackPanel>
  
    <Button Content="Add Popup" Click="Button_Click_1"></Button>
    </StackPanel>
</Grid>


MAINPAGE C#:
 
// Constructor
public MainPage()
{
    InitializeComponent();         
}
 
static Popup pop;
 
void CreatePop()
{
    pop = new Popup { Child = new exampleControl() };
    pop.IsOpen = true;
}
 
private void Button_Click_1(object sender, RoutedEventArgs e)
{
    CreatePop();
}

EXAMPLECONTROL XAML:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" Background="Red">
 
    <StackPanel>
        <Image HorizontalAlignment="Center" Height="100" VerticalAlignment="Center" Width="100" Source="/ApplicationIcon.png" Margin="0,200,0,0" telerikPrimitives:RadToolTipService.ShowGesture="Tap" telerikPrimitives:RadToolTipService.ToolTip="yeehaw2"  ></Image>
    </StackPanel>
</Grid>

1 Answer, 1 is accepted

Sort by
0
Accepted
Victor
Telerik team
answered on 11 Feb 2013, 09:35 AM
Hello Tony,

Thank you for writing.
I am afraid that RadTooltip currently does support opening inside a popup. The Silverlight popup creates a separate element tree that is parallel to the page's element tree. When the popup opens it tries to find its page because it contains vital information. Since the tooltip is inside a popup the page is not found and the tooltip crashes.

We should throw a more meaningful exception in this case since a NullReferenceException gives no information about what might be wrong. We will change that in the next release.

Thank you for understanding.

Greetings,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
ToolTip
Asked by
Tony
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or