PopupControlContainer location and alignment
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
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
SIGN IN To post a reply.
5 Replies
AA
Arulraj A
Syncfusion Team
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.
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
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
AD
Administrator
Syncfusion Team
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.
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.
LS
Lingaraj S
Syncfusion Team
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).
Please let me know if you have any queries. Thanks for providing additional information any.
Regards,
Lingaraj S.
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.
CO
CoolDolphin
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));
}
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));
}
AA
Arulraj A
Syncfusion Team
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
Thanks for the update
The code you provided works fine. Please let us know if you have any further concerns.
Regards,
Arulraj.A
SIGN IN To post a reply.
- 5 Replies
- 4 Participants
-
AD Administrator
- Jun 17, 2010 07:34 PM UTC
- Apr 16, 2011 04:45 AM UTC