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
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
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
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