I have a multi tabbed tabcontrol where each tab control has a gridview. The first time a user clicks a tab I bind the data to the gridview. There is a long pause when a user first clicks on the tab and I can live with that. However, I can't seem to get my status bar to display or even just change the Tabitem header to read "Loading" while the tabitem is rendered. I am subscribing to the selectionchanged event but my first few lines of code seem not to run until the entire procedure completes.
My code is as follows (BTW I have tried using background workers to do the heavy lifting to no avail.) I put some comments in the code lines to indicate where I am having the problem.
void tc_SelectionChanged(object sender, RoutedEventArgs e)
{
Telerik.Windows.Controls.RadTabControl tc = (Telerik.Windows.Controls.RadTabControl)sender;
//this is a tabitem class derived from RadTabItem
FTSilverControls.FTReportTabItem ti = (FTSilverControls.FTReportTabItem)tc.Items[tc.SelectedIndex];
if (f.CanShowHistory)
{
try
{
List<string> ids = new List<string>();
ids.Add(rad.Data[0].DataItems[0].Uid);
if (!ti.IsPopulated)
{
tc.FontSize = 20;
//the ui layer does not seem to process until ProcessActivityTab completes which essentially means you never see my status bar.
//I have tried invalidating the control, calling update layout, pausing the thread
ShowStatus("Formatting Data for " + ti.Header.ToString());
ProcessActivityTab(ti);
}
}
catch
{
}
}
else
{
tabs.Add(ti);
}
}
private void ProcessActivityTab(FTSilverControls.FTReportTabItem ti)
{
FTSilverControls.FTGenericReportTable win = new FTSilverControls.FTGenericReportTable(ti.Header.ToString(), a.ReadFromStorage(ti.Tag.ToString(), a.SpecialDirs["dialogs"], true), a.HistoryDocuments[ti.Tag.ToString()], a.Username, a.Password, ids, "", a.Menunames, false);
FTSilverControls.FTGenericReport rep = new FTSilverControls.FTGenericReport(win);
ti.AddReport(rep);
rep.Height = 310;
rep.Width = 1145;
ti.Gv = win.Gview;
ti.Rep.DoAutoFilter(GetSelectionLayerNames(rad.SelectionManager.SelectedItems[0], "id"));
HideStatus();
}
My code is as follows (BTW I have tried using background workers to do the heavy lifting to no avail.) I put some comments in the code lines to indicate where I am having the problem.
void tc_SelectionChanged(object sender, RoutedEventArgs e)
{
Telerik.Windows.Controls.RadTabControl tc = (Telerik.Windows.Controls.RadTabControl)sender;
//this is a tabitem class derived from RadTabItem
FTSilverControls.FTReportTabItem ti = (FTSilverControls.FTReportTabItem)tc.Items[tc.SelectedIndex];
if (f.CanShowHistory)
{
try
{
List<string> ids = new List<string>();
ids.Add(rad.Data[0].DataItems[0].Uid);
if (!ti.IsPopulated)
{
tc.FontSize = 20;
//the ui layer does not seem to process until ProcessActivityTab completes which essentially means you never see my status bar.
//I have tried invalidating the control, calling update layout, pausing the thread
ShowStatus("Formatting Data for " + ti.Header.ToString());
ProcessActivityTab(ti);
}
}
catch
{
}
}
else
{
tabs.Add(ti);
}
}
private void ProcessActivityTab(FTSilverControls.FTReportTabItem ti)
{
FTSilverControls.FTGenericReportTable win = new FTSilverControls.FTGenericReportTable(ti.Header.ToString(), a.ReadFromStorage(ti.Tag.ToString(), a.SpecialDirs["dialogs"], true), a.HistoryDocuments[ti.Tag.ToString()], a.Username, a.Password, ids, "", a.Menunames, false);
FTSilverControls.FTGenericReport rep = new FTSilverControls.FTGenericReport(win);
ti.AddReport(rep);
rep.Height = 310;
rep.Width = 1145;
ti.Gv = win.Gview;
ti.Rep.DoAutoFilter(GetSelectionLayerNames(rad.SelectionManager.SelectedItems[0], "id"));
HideStatus();
}