[DevExpress Support Team: CLONED FROM T302940: DXValidation Not working on controls that are behind a tabbed group control]
Hello,
I am having same issue with my WinForm App with XtraTabControl.
I have nested Tab Controls, each with multple pages. As suggested, I looped through TabPages of each control and programmatically set them to be SelectedPage. But the validation still fails. Validation works only on page which is made to be selected page LAST in the loop. I tried putting Application.DoEvents() also but it did not help.
Here is my function which accepts XtraTabControl and loops through its pages. Do I need to do something else.
Also, if I click that particular page where validation fails, manually, the validation works!!
C#private void ActivateTabPage(XtraTabControl tabControl)
{
//This Loop is required so that databinding will take effect on hidden tab pages (which does not unless tabpage is activated) and Validation will happen correctly
//https://www.devexpress.com/Support/Center/Question/Details/T302940/dxvalidation-not-working-on-controls-that-are-behind-a-tabbed-group-control
foreach (XtraTabPage tabPage in tabControl.TabPages.Where(p => p.PageVisible))
{
tabControl.SelectedTabPage = tabPage;
//Application.DoEvents();
}
if (tabControl.TabPages.Count(p => p.PageVisible) > 0)
{
int minIndex = tabControl.TabPages.Where(p => p.PageVisible)?.Min(p => p.TabIndex) ?? -1;
if (minIndex >= 0) tabControl.SelectedTabPage = tabControl.TabPages[minIndex];
}
}
Your code looks correct to me. It is difficult to give you a precise answer about the cause of the issue without reproducing this problem on our side.
There may be a lot of different factors that affect the problem. Would you please send me a sample where you faced the problem so I can thoroughly research it and help you?
Your time and cooperation are greatly appreciated.
Hello Stas,
Here is the sample.
Problem is despite looping through all the tabPages, it requires me to click the xtraTabPage4 manually for correct validation.