Show 'MessageBox' at center of RadPane

157 views Asked by At

I have several RadPanes and RadPanGroups in my WPF application built using Telerik controls.

I want to show a custom window (kind of message box) that is center to a particular RadPane not center to whole window or parent window or screen.

I want to set Top and Left of custom window according to activated RadPane

1

There are 1 answers

0
Vanghern On

It might be a little workaround, but this topic might help you. The idea is, to capture mouse position, while firing an event. You didn't say what causes your window to open, I assume it is MouseDoubleClickEvent, so this might suit you.

Another option (haven't tried it) is to capture sender parameters within your event. After firing an event, you have sender (which is object, in your case RadPane), which returns VisualOffset of a component (which has 4 coordinates). Then you can manually set your window position as follows:

Window window = new Window();
window.Left = offsetTop - x;
window.Top = offsetLeft - y;

Unfortunately, WindowStartupLocation property, allows you to set it only to CenterOwner (center of parent window), CenterScreen and Manual. And well, Manual sounds really good, but it still requires you to know exact position of sender (parent).