Can the WinForms radCallout control be used to show a popup on a custom user control which is added to custom painted canvas?

2 Answers 36 Views
Callout Flyout
Sven
Top achievements
Rank 1
Iron
Sven asked on 30 Jan 2025, 03:13 PM

Nothing is displayed when I try this code:

UserControls.ucCallout oCallOutForm = new UserControls.ucCallout();            

radCallout.AssociatedControl = oCallOutForm;

radCalloutMarkers.Show(MyCustomUserControl);

When I change the last line to this, the CallOut form is being displayed, but it's being displayed on top of everything else (even other open application windows):

radCalloutMarkers.Show(System.Windows.Forms.Cursor.Position);

I would like to have a callout form which contains a button and when clicked it should show a flyout input form to enter some text.   When I use the callout pointing to the cursor position instead of a control, the flyout window is painted behind the callout form so no user input is possible.

2 Answers, 1 is accepted

Sort by
0
Accepted
Sven
Top achievements
Rank 1
Iron
answered on 06 Feb 2025, 08:30 AM | edited on 06 Feb 2025, 08:41 AM

Hi Dinko,

The scenario I'm trying to use is the following:

- Sample project with a custom user control.  This user control has some UI elements on it.

- The user control is added to the main form programmatically as needed.   A on-hover event is added to this user control.

- When the on-hover event of the user control is fired, the radcallout form is created and shown.    To open the radcallout form, I'm using the Show(System.Windows.Forms.Cursor.Position) function .  I also tried to use Show(myCustomUserControl) but the callout window is not being shown if I use that.

- The callout form contains a button to open a radflyout window to allow for additional user input.   This is where I'm having difficulties.   The flyout form is shown behind the already open callout form.

I have updated your sample project with the scenario I'm trying to achieve.   You'll notice the problem after you click the "add note" button on the call out form.

Thanks!

Dinko | Tech Support Engineer
Telerik team
commented on 06 Feb 2025, 01:14 PM

Thank you for the updated project. The behavior is a result of having multiple forms that are topmost. The RadCalloutForm is TopMost and the flyout form (RadOverlayForm) is also topmost. As the RadCalloutForm is shown first, the flyout will be placed underneath. What you can do here is to set TopMost property of the RadCalloutForm to false.

private void radButton1_MouseEnter(object sender, EventArgs e)
{
    radCallout1.CalloutForm.TopMost = false;
    this.radCallout1.Show(this.radButton1);
}

Now you will get the following result:

A need to point out that the flytout is using a different thread inside its code. That is why executing RadFlyoutManager.Close() in the ucNote UserControl will lead to a cross-thread error. To avoid the error wrap the Close() method inside Invoke() method

private void button2_Click(object sender, EventArgs e)
{
    this.Result = DialogResult.Cancel;

    this.Invoke((Action)(() => { 

        Telerik.WinControls.UI.RadFlyoutManager.Close();

    }));
}

I hope that I was able to help you.

Sven
Top achievements
Rank 1
Iron
commented on 10 Feb 2025, 04:20 PM

Hi Dinko,

Your solution fixed my issue.   Thanks a lot for your help!

Sven

Sven
Top achievements
Rank 1
Iron
commented on 11 Feb 2025, 11:07 AM

@Dinko,

One last question:   is it possible to pass parameter values to the flyout form?   I would like to open the flyout out window and it should show existing text which I pass via a variable to the flyout form.

Thanks!

Dinko | Tech Support Engineer
Telerik team
commented on 12 Feb 2025, 01:55 PM

For that purpose, you can use the ContentCreated event. In the event handler, you can get an instance the UserControl pass as a parameter to the Show() method. You can use it to pass information to the flyout content.

private void radButton2_Click(object sender, EventArgs e)
{
    if (RadFlyoutManager.IsActive)
        RadFlyoutManager.Close();

    RadFlyoutManager.FormLoad += RadFlyoutManager_FormLoad;

    RadFlyoutManager.ContentCreated += RadFlyoutManager_ContentCreated;
    RadFlyoutManager.Show(this, typeof(ucNote));
}

private void RadFlyoutManager_ContentCreated(ContentCreatedEventArgs e)
{
    var userControl = (e.Content as ucNote);           
}

 

 

0
Dinko | Tech Support Engineer
Telerik team
answered on 04 Feb 2025, 08:55 AM

Hello Sven,

Thank you for your interest in our RadCallout control for WinForms.

I'm not sure I fully understand your scenario. To test it, I created a sample project with a UserControl containing RadTextBox and RadButton controls. When I click the button, I call the Show() method, which displays the callout. I can then type in the input controls and click the buttons without any issues.

Could you review my test project and let me know what I might be missing or how the control should behave differently?

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Callout Flyout
Asked by
Sven
Top achievements
Rank 1
Iron
Answers by
Sven
Top achievements
Rank 1
Iron
Dinko | Tech Support Engineer
Telerik team
Share this question
or