From 0e7ce76f01b30e8a4cd469e637305ec091b837b9 Mon Sep 17 00:00:00 2001 From: ReignStumble Date: Thu, 5 Jul 2018 23:43:01 -0400 Subject: [PATCH] Wait for UI to render before Populating --- DICUI/MainWindow.xaml.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/DICUI/MainWindow.xaml.cs b/DICUI/MainWindow.xaml.cs index d35aa6d6..a8dbac2f 100644 --- a/DICUI/MainWindow.xaml.cs +++ b/DICUI/MainWindow.xaml.cs @@ -27,6 +27,24 @@ namespace DICUI private Options _options; private OptionsWindow _optionsWindow; + bool _shown; + + protected override void OnContentRendered(EventArgs e) + { + base.OnContentRendered(e); + + if (_shown) + return; + + _shown = true; + + // Populate the list of systems + PopulateSystems(); + + // Populate the list of drives + PopulateDrives(); + } + public MainWindow() { InitializeComponent(); @@ -35,11 +53,7 @@ namespace DICUI _options = new Options(); _options.Load(); - // Populate the list of systems - PopulateSystems(); - // Populate the list of drives - PopulateDrives(); } #region Events