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

Show in lower right corner of window

3 Answers 628 Views
Callout
This is a migrated thread and some comments may be shown as answers.
Heiko
Top achievements
Rank 1
Iron
Veteran
Heiko asked on 14 Aug 2020, 12:57 PM

Now I have the honor of being the first to write something on the subject. :-)

I would like to display a callout in the lower right corner of my window - similar of what NotifyIcon does in the taskbar. The documentation mentions some "Absolute..." placements, but is very sparse in explaining the usage. It should just behave like the usual "Toaster" components that are often used on webapplications.

Regards
Heiko

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 14 Aug 2020, 02:51 PM

Hi Heiko,

Thank you for your interest in our controls. Speaking of NotifyIcon, you can expect its official version in mid-September with R3 2020 Release.

As for the Callout, in its Popup usage mode, it can be positioned with API very similar to the normal MS Popup which has PlacementTarget, vertical, horizontal offsets, relative or absolute positioning, etc. For example to attach a callout to parent window and show it in the lower right corner you can use this sample code (of course with more detailed size calculations if needed):

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RadCallout callout = new RadCallout() { Content = "Bottom Right Callout" };
            CalloutPopupSettings settings = new CalloutPopupSettings();
            settings.VerticalOffset = this.ActualHeight - 100;
            settings.HorizontalOffset = this.ActualWidth - 150;
            settings.Placement = System.Windows.Controls.Primitives.PlacementMode.RelativePoint;


            CalloutPopupService.Show(callout, this, settings);
        }

I am attaching here a sample picture of the result on my side for reference. Let me know if you have any additional questions.

Regards,
Petar Mladenov
Progress Telerik

0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 14 Aug 2020, 04:40 PM

Hi Petar,

thank you for your fast reply. Yes, your code is working, but only if I place it inside Window_Loaded event. If I place it somewhere else in a function it won't work properly. The Callout is then placed on the bottom of the screen, not the window where it should be.

public void ShowCallout(string message)
{
    Window mainWin = Application.Current.MainWindow;
 
    RadCallout callout = new RadCallout()
    {
        Content = message,
    };
 
    CalloutPopupSettings settings = new CalloutPopupSettings()
    {
        HorizontalOffset = mainWin.ActualHeight - 100,
        VerticalOffset = mainWin.ActualWidth - 150,
        Placement = System.Windows.Controls.Primitives.PlacementMode.RelativePoint,
    };
 
    CalloutPopupService.Show(callout, mainWin, settings);
}

 

Regards
Heiko

0
Petar Mladenov
Telerik team
answered on 17 Aug 2020, 04:01 PM

Hi Heiko,

I tried to reproduce the mentioned behavior in a button click handler but everything ran as expected. Could you please take a look at my test project and le me know what should be changed in order to reproduce it ? Thank you in advance.

Regards,
Petar Mladenov
Progress Telerik

Tags
Callout
Asked by
Heiko
Top achievements
Rank 1
Iron
Veteran
Answers by
Petar Mladenov
Telerik team
Heiko
Top achievements
Rank 1
Iron
Veteran
Share this question
or