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

How to open the popup for the RadDropDownButton at the user's mouseclick position?

1 Answer 102 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 30 Jun 2011, 08:12 PM
Hello Telerik,

I'm using a RadDropDownButton as a sort of clickable popup tooltip.  I'd like it if the popup would appear positioned at the user's mouseclick coordinate.

I thought that was the intent of DropDownPlacement="Absolute" but it seems to set it below the button regardless.  I wondered if it might have been the logic that repositions the popup for screen edge detection, but even if I place the popup in the middle of the screen I still don't get the desired effect.

Am I doing something incorrectly, or is there a way to move the popup?

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 06 Jul 2011, 09:23 AM
Hello Rob,

This cannot be achieved with the RadDropDownButton. You said that you try it as a sort of clickable PopupTooltip. So, does creating a custom control (Button + Popup) fit in your scenario? If yes, you could use a RadButton and System.Windows.Controls.Popup that is controlled in the MouseLeftButtonDown event handler like so:
public MainPage()
       {
           InitializeComponent();
           this.button.AddHandler(RadButton.MouseLeftButtonDownEvent, new MouseButtonEventHandler(RadButton_MouseLeftButtonDown), true);
       }
 
       private void RadButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
       {         
 
           System.Windows.Controls.Primitives.Popup pop= new System.Windows.Controls.Primitives.Popup();
           pop.Width = 300;
           pop.Height = 300;
           pop.Child = new Rectangle() { Width = 200, Height = 200, Fill = new SolidColorBrush() { Color = Colors.Blue }};
           pop.VerticalOffset = e.GetPosition(this.LayoutRoot).Y;
           pop.HorizontalOffset = e.GetPosition(this.LayoutRoot).X;
           pop.IsOpen = true;
 
       }
Please let us know if this helped you.

Regards,
Petar Mladenov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Buttons
Asked by
Rob
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or