0

I implemented a sample application:

enter image description here

You can select the type that is used for the data grid that is then displayed in the dialog. If the user clicks the button, this code will be executed:

private void ShowDialog()
{
  Window dialogView = (Window)Activator.CreateInstance(dialogs[selectedDialog]);
  dialogView.ShowDialog();
}

Findings:

  1. If “WPF” is selected, the dialog and DataGrid will be displayed immediately.
  2. If “Infragistics” is selected, it takes more than a second for displaying the dialog and XamDataGrid.
  3. If the “Infragistics” dialog is opened a second time, it will show up much faster.

Then I started profiling and clicked the button for “WPF” and two times “Infragistics”. Here is the timeline for these three clicks:

enter image description here

The XAML of the “Infragistics” dialog looks like this:

<Grid DataContext="{Binding DataGridDialog, Source={StaticResource Locator}}">
  <igDP:XamDataGrid DataSource="{Binding Rows}" Width="300" Height="300"/>
</Grid>

The XAML of the “WPF” dialog looks like this:

<Grid DataContext="{Binding DataGridDialog, Source={StaticResource Locator}}">
  <DataGrid ItemsSource="{Binding Rows}" Width="300" Height="300"/>
</Grid>

Anyway, the gap between the button click and the “Infragistics” dialog being displayed the very first time is not acceptable for a user. That is why I wrote the following code in the code behind for the "Infragistics" dialog that enables a busy indicator between the events “Initialized” and “Loaded”. Unfortunately the busy indicator's animation is not responsive:

public partial class InfragisticsDataGridDialogView : Window
{
  private IUserInteractionService userInteractionService;
  private TaskCompletionSource<object> tcs;

  public InfragisticsDataGridDialogView(IUserInteractionService userInteractionService)
  {
    this.userInteractionService = userInteractionService;
    Loaded += OnLoaded;
    Initialized += OnInitialized;
    InitializeComponent();
  }

  private async void OnInitialized(object sender, EventArgs e)
  {
    tcs = new TaskCompletionSource<object>();
    await ShowBusyIndicatorAsync(tcs.Task);
  }

  private async Task ShowBusyIndicatorAsync(Task task)
  {
    await userInteractionService.ShowBusyIndication("Opening dialog", task);
  }

  private void OnLoaded(object sender, RoutedEventArgs e)
  {
    tcs.SetResult(null);
  }
}

Is there a way to make the busy indicator responsive? The busy indicator is a Grid in the main Window:

<Grid Visibility="{Binding UserInteractionService.ShowBusyIndicator, Converter={StaticResource BoolToVisibilityConverter}}">
  <ProgressBar APProgressBar.SubTitle="{Binding UserInteractionService.BusyMessage}" IsIndeterminate="True" />
</Grid>
roger
  • 271
  • 1
  • 7
  • The control is complex and takes a long time to render. Have you https://www.infragistics.com/community/blogs/b/kiril_matev/posts/optimizing-xamdatagrid-performance yet? As for faster on second startup, that's not surprising as they're probably caching everything they create on first display. You might be able to take this initial hit early by 1) create an STA thread 2) on this thread create a new instance of the xamdatagrid, set its size and stick in some data, and 3) trigger a render via a RTB https://stackoverflow.com/questions/5403831/how-to-create-an-image-of-a-wpf-usercontrol-at-runtime –  Jan 29 '18 at 19:53
  • Thank you @Will for your time! Yes I read this and another article about JIT IL in advance. But because the gap when using a more advanced grid is 4 seconds, I decided to go with a busy indicator. The DataGrid has to support features like filtering, sorting and CRUD operations. Therfore a bitmap can't be used. – roger Jan 30 '18 at 07:30

0 Answers0