with sample code from Infragistics, in order to add XamDialogWindow, need to do as:
1. add Canvas in parent control as popbase.
2. then add an instance of XamDialogWindow to Canvas's children collection.
In this way, XamDialogWindow will popup in the center of the parent control.
My question is: how to put the popup in the center of the hosting browser?
have try in different way:
1.if do nothing, popup will be at top-left of browser window.
2. try set following:
XamDialogWindow.StartupPosition = StartupPosition.Center;XamDialogWindow.StartupPosition = StartupPosition.Center;XamDialogWindow.CenterDialogWindow();
the popup will be always at the right of the center point.
vertical position looks like fine.
How to resolve this problem?
Hello,
I have been looking into your question and I can suggest you handle the ‘SizeChanged’ event of the UserControl and call the ‘CenterDialogWindow’ method of the XamDialogWindow like :
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
this.XamDialogWindow1.CenterDialogWindow();
}
This way the XamDialogWindow control will be always positioned in the center of browser.
If you need any further assistance on this matter, feel free to ask.
thank you. weird thing is: for some cases, it is work, for others not. not sure the reason.
If there content of popup including XamDataGrid or ListBox with template, centralizing not working properly.
okay. Here is more info this case:
1. there is a SubClass from XamDialogWindow
public class XamDialogWindowEx : XamDialogWindow { public XamDialogWindowEx() : base() { IsMoveable = true; IsModal = true; IsResizable = true; Close(); } public void ShowAndFocus() { this.StartupPosition = StartupPosition.Center; this.CenterDialogWindow(); Show(); Focus(); } ....}
2. code to show the diag in a button click event:(the instance is created in the user control constructor)
myDialog.Content = mycontrol; myDialog.ShowAndFocus();
At first time click on the button, it is not show in center, but click on second time or after, it is okay.
the problem is caused by Close() in constructor. Not sure why. How to fix it?
I have been looking into your last post and it seems that I am missing something. Would you please provide me with an isolated sample application which demonstrates your issue?
Looking forward to hearing from you.
AutoComplete=true still need 2 typing: hit Tab 2 times, but it is better than Enter + Tab. Thanks.
I have been looking into your last post and I am not sure where you set the ‘AutoComplete’ property. Is there any reason because you are not able to attach a sample application following your scenario ?
Sorry, put it in wrong post. I have resolved this issue in SizeChanged event for XamDialogWindow, not the user control. Thanks.