/// <summary> /// Handles the selection change between tabs, so that we can adjust the height of the Browse Panel, /// showing/or hiding information that is not relevant. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TabControl1_SelectedIndexChanged(object sender, SwitchPageArgs e) { bool moved = false; switch (e.PageNum) { case 2: if (hboxOptions.Parent != alignRainChart) { hboxOptions.Reparent(alignRainChart); moved = true; } break; case 3: if (hboxOptions.Parent != alignRainMonthly) { hboxOptions.Reparent(alignRainMonthly); moved = true; } break; case 4: if (hboxOptions.Parent != alignTemp) { hboxOptions.Reparent(alignTemp); moved = true; } break; case 5: if (hboxOptions.Parent != alignRadn) { hboxOptions.Reparent(alignRadn); moved = true; } break; default: break; } if (moved) { // On Windows, at least, these controls don't move correctly with the reparented HBox. // They think they're parented correctly, but are drawn at 0,0 of the main window. // We can hack around this by reparenting them somewhere else, then moving them back. Widget pa = spinStartYear.Parent; spinStartYear.Reparent(MainWidget); spinStartYear.Reparent(pa); pa = spinNYears.Parent; spinNYears.Reparent(MainWidget); spinNYears.Reparent(pa); } if (GraphRefreshClicked != null) { GraphRefreshClicked.Invoke(notebook1.CurrentPage, spinStartYear.ValueAsInt, spinNYears.ValueAsInt); } }