We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PopupControlContainer location and alignment

Thread ID:

Created:

Updated:

Platform:

Replies:

95055 Jun 17,2010 07:34 PM UTC Apr 16,2011 04:45 AM UTC WinForms 5
loading
Tags: Tools
Administrator [Syncfusion]
Asked On June 17, 2010 07:34 PM UTC

I'm using a PopupControlContainer and associating it with a TextBox and it's working well.
But, I was wondering if there's a way to influence the location when it pops up.
Right now, it seems to display below the TextBox if it can but it will display above the TextBox if there isn't enough room below.
Is there a way to make it always dispay above the associated control if it can? that is, make "above the control" the default?

thanks,
Mark

Arulraj A [Syncfusion]
Replied On June 21, 2010 09:52 AM UTC

Hi Mark,

Thanks for your interest in Syncfusion Products.

To make the popup always on the top of the Control, you can make use of the Location of the ParentControl and decrease the Y value with popupControlContainer's height and then call the ShowPopup() method points to the control's(here TextBox) parent(here GroupBox) PointToScreen. The below code explains the same.

private void dropDownBtn_Click(object sender, System.EventArgs e)
{
this.popupControlContainer1.ParentControl = this.sourceTextBox;
Point loc = this.sourceTextBox.Location;
loc.Y -= this.popupControlContainer1.Height;
this.popupControlContainer1.ShowPopup(this.sourceTextBox.Parent.PointToScreen(loc));
}


Here is a sample for your reference.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=PopupDemo328389169.zip

Please Let me know if you have any further concerns.

Regards,
Arulraj.A

Administrator [Syncfusion]
Replied On June 21, 2010 06:43 PM UTC

Well, I don't just want to make the popup display above the parent control. I really want to make it popup above when it can and below when there's not enough room above.

It seems like popping up below is the default or preferred location. I'd like to make "above" the default but I don't necessarily want it to popup above the control 100% of the time.

I started looking into some of the virtual methods in the PopupHost control. Some of them look promising.

Lingaraj S [Syncfusion]
Replied On June 22, 2010 05:05 AM UTC

Hi Mark,

Thank you for the update.

By default, PopupControlContainer will show above when the space is not enough in below the parent control. I have attached video file to demonstrate the behavior.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=TestVideo-1643842987.zip

Below code is used to show the popupcontrolcontainer below when not enough space in above control(Previous provided sample).

this.popupControlContainer1.ParentControl = this.sourceTextBox;
Point loc = this.popupControlContainer1.ParentControl.Location;
loc.Y -= this.popupControlContainer1.Height;
if (Screen.PrimaryScreen.Bounds.Contains(this.popupControlContainer1.ParentControl.PointToScreen(loc)))
{
this.popupControlContainer1.ShowPopup(this.popupControlContainer1.ParentControl.Parent.PointToScreen(loc));
}
else
{
this.popupControlContainer1.ShowPopup(Point.Empty);
}


Please let me know if you have any queries. Thanks for providing additional information any.

Regards,
Lingaraj S.

CoolDolphin
Replied On April 11, 2011 02:59 AM UTC

Hi! I apologize for my English.
The above code I have not worked! Had to be rewritten. Spread your option:

Point locationPopUp = new Point(-((popUpContainer.Width / 2) - (simpleButton3.Width / 2)), simpleButton3.Height + 2);
Point bottomPointPopUp = new Point(locationPopUp.X, locationPopUp.Y + popUpContainer.Height + 5);
if (Screen.PrimaryScreen.WorkingArea.Contains(simpleButton3.PointToScreen(bottomPointPopUp)))
{
popUpContainer.ShowPopup(barManager, simpleButton3.PointToScreen(locationPopUp));
}
else
{
locationPopUp.Y -= simpleButton3.Height + popUpContainer.Height + 10;
popUpContainer.ShowPopup(barManager, simpleButton3.PointToScreen(locationPopUp));
}


Arulraj A [Syncfusion]
Replied On April 16, 2011 04:45 AM UTC

Hi,

Thanks for the update

The code you provided works fine. Please let us know if you have any further concerns.

Regards,
Arulraj.A



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;