Note that there are some explanatory texts on larger screens.

plurals
  1. POusing the dispatcher to load usercontrols in WPF
    text
    copied!<p>I have a user control that has a grid with like 2900 items in it, there is nothing I can do about this cause that is the way the business want's it... Obviously this is slow to load/render so I created this trick using the dispatcher, in the view model that handles the event (prism event... not a standard windows event). </p> <pre><code> public void ShowPopUp(Type viewType) { var waitScreen = new Controls.Views.SampleView(); var popUp = new ShellBlank(); popUp.Content = waitScreen; popUp.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; popUp.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(delegate() { popUp.Content = container.Resolve(viewType);}) ); popUp.ShowDialog(); } </code></pre> <p>It works just fine however on my SampleView (as it is called at the moment) there is an in-determinant progress bar however it never updates, like you know - the green bara going back and fourth... Here is the XAML for it. </p> <pre><code> &lt;Border&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition/&gt; &lt;RowDefinition/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Label Margin="12" FontSize="16" Foreground="WhiteSmoke" Content="Loading... Please wait"/&gt; &lt;ProgressBar Grid.Row="1" IsIndeterminate="True" Width="280" Height="24"/&gt; &lt;/Grid&gt; &lt;/Border&gt; </code></pre> <p>Is it something to do with the dispatcher not letting it update?</p> <p>Anyone ever done something like this? got any suggestions? </p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload