Need to display meaningful information, be it alerts, hints, tips, etc? Then greet the hero of R2 2020 Release of Telerik UI for WPF—the RadCallout control.
Remember how we all thought that buttons are everywhere? Well, while developing the hero of today’s talk, I changed my mind about that. I started seeing Callouts everywhere, but there was no other like our star—one of the shiniest accents of the R2 2020 release of Telerik UI for WPF. Everybody, please welcome the brand-new RadCallout. 🥳
I’m sure that all of you have already met a callout in your lives, at least once. Some of you may not know that it’s referred to as a callout. Others might relate it to the thought or speech bubbles used in comic strips. All golden Microsoft Office fans surely still remember Clippit. The cute cartoon paperclip, seen in versions 2000 through 2003, and its helpful callouts. But what’s so special about ours? Let’s call out the RadCallout and find out.
What do you see? A tiny, fluffy, cloudy text box with a small tail that you can point to different locations. Pretty simple, huh, yet so satisfying and unbelievably (at first sight) powerful. Let me guide you through its superpowers.
I could not help but start exactly with this one. Since the callout control is a content control, designed to display a piece of meaningful information, be it alerts, hints, tips, etc., I believe the shape of it is the part responsible for the best representation. You can’t warn your users that if they don’t change their expiring password, they may not be able to log in ever again, in the shape of a heart for example, can you? Let’s cut the small talk and explore the shape options that the RadCallout offers.
The control comes with five built-in shape types, plus one very special option. The CalloutType is an enumeration and it allows the following values—Rectangle, RoundedRectangle, Ellipse, Cloud, Kaboom (the one jazzy, glaring shape with the many lines connecting to form numerous triangular edges).
The last option is intentionally out of the list of built-in shapes—it's the Custom shape option. The one responsible for the heading of this section, the one giving you the un-limitedness. Using it, you need to provide a custom geometry. I really love it, because it allows you to get into your stride and build a very cool and unique shape for your callout.
Explore them all and play with the themes and colors in the Color Theme Generator application. Like the rest of the controls from the Telerik UI for WPF, the Callout control comes with a set of themes you can use to create a consistent and modern looking user experience.
P.S. The last one of the custom callout types is catchy, isn’t it? And since I like you, I’ll show you how it’s done:
Margin="10 0" CalloutType="Custom"
MeasurePathWithInfinity="False" Stretch="Fill" ArrowType="None"
<telerik:Label Content="CalloutType - Custom, ArrowType - None" FontSize="10" Margin="0 0 0 15"/>
Don’t be shy and always aim beyond the basic settings like spacing, background and border color. Of course, the RadCallout allows it. Adjust everything you wish to end up with the perfect callout for your app. Don’t just change text color and style, or the vertical and horizontal offsets.
Be brave, play with the properties which determine the look and feel of the connection point for the callout body—the arrow. Check out the following properties:
So far, so unclear, but let me try to explain.
The above properties for customizing the arrow of the RadCallout’s geometry are all of type Point, representing relative coordinates (between 0 and 1). For example, X = 0 and Y = 0 means the top-left point of the callout body and X = 1, Y = 1 - the bottom-right point. In the following figures you can see the default values of the properties [0.25, 0.5], [0.75, 0.5] and [0.5, 1.25].
Important thing! The width and height of the callout applies only to the body of the geometry, without the arrow. Why? Because this makes it very easy to keep a fixed size of the main shape, while making bigger arrows which exceed the shape size. How to make those bigger arrows—simply set big Y of the ArrowAnchorPoint. To make the arrow included in the callout size, you can set MeasurePathWithInfinity property to False.
Default Arrow Point Coordinates
Custom Arrow Point Coordinates
The Red, Green and Blue points in the figures are not part of the control. Demonstrative purpose only.
We’ve already stepped into the possible ways of using the RadCallout in a WPF app. In the above code snippet with the custom geometry, I demonstrated the XAML declaration of the control. The choice of a parent container in this case is completely in your hands—choose the best one for displaying your content in the most relevant way.
Now, I want to dig deeper into the other possibility. Showing the callout in an animated Popup, using the CalloutPopupService class.
Want to show the callout above your application content and enable interaction via actions such as clicking, hover, keyboard navigation, etc.? Sure, then the CalloutPopupService class will be of great help as it provides the needed methods and events to do so. Use it for showing the callout, closing a given callout, closing all callouts at once and disabling the popup animation. Believe me, this is just a brief intro into this wonderful option. This service class goes together with the CalloutPopupSettings class.
The CalloutPopupSettings class has a really long list of powerful properties that you could benefit from to completely configure the popup up to your liking. You can choose whether the popup will be auto centered, or auto closed, should it move with the parent placement target window, should it show in the intended placement position in case of exceeding the monitor boundaries.
Of course, I should’ve started with the Placement options, represented by the PlacementMode enumeration, allowing the following values—Absolute, Relative, Bottom, Center, Right, AbsolutePoint, RelativePoint, Mouse, MousePoint, Left, Top, Custom.
Animation configuration options are also worth mentioning as they greatly contribute to the customization capabilities of the control. I’ll even put them in a separate section, coming right up… or actually down. 🤔
Whoa, that was a long list represented quickly… 😵 (for such a tiny at first sight control).
If you are already intrigued by the popup service, make sure to play around with the animations to achieve the best experience for the end users. I will be more than glad to guide you through it.
When setting up the animation of your callout popup, you can choose from the CalloutAnimation enumeration. It allows the following values: None, Fade, Move, FadeAndMove, Reveal, FadeAndReveal, Scale, FadeAndScale.
You can specify different animation types for the callout popup by using the ShowAnimationType and CloseAnimationType properties. Also, you can be the one in control for the durations of these animations, as well as their delays.
In case you’ve missed the blog post for the R2 2020 release of Telerik UI for WPF, I’ll drop the GIF, showing the animations in action:
This has already started to look like a whole introduction of a book, so I think it’s time to close the curtains on this lovely blog. But… before this.
When using the RadCallout (I’m sure you will), think of it as your best helper for making it easy to highlight important information. Use it to alert customers to a special discount, highlight a testimonial or add weight to particularly important text content. Spotlight free shipping, discounts, price matching and more. Draw attention to unique selling points and important product details and benefits. Whatever you like. Just use it wisely to make your application content stand out.
Speaking of wisdom, the best thing would be to benefit from the outstanding possibility to integrate the Callout control with other UI controls from the Telerik UI for WPF such as Maps, Charts, Tooltip, Slider, etc. For some of those integrations (as well as others), make sure to check the documentation and the awesome control examples in our WPF demos application.
We will never get tired of encouraging you to share your thoughts with us by dropping us a comment below, or using the Feedback portal about UI for WPF, because we highly value your honest feedback. It really matters!
In case you haven’t already done so, do not hesitate to try out the latest:
Viktoria Grozdancheva is a frontend developer, part of the Progress Telerik UI for WPF & Silverlight team in Sofia. She holds a bachelor's degree in Computer Systems and Technologies. In her spare time, Viktoria loves practicing (and constantly updating) her collection of art hobbies, playing sports and hanging out with friends.
Subscribe to be the first to get our expert-written articles and tutorials for developers!