Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance issue when hosting a WPF form in a native C++ application
    primarykey
    data
    text
    <p>I have WPF window which runs fine when hosted in a WPF application but when I load it from within my native C++ application it takes a very long time to render and the UI Thread blocks until it completes.</p> <p>The main offender on my window is an series of items controls used to display a 9 by 12 grid of icons which represent states of components within my system.</p> <p>The whole items control takes up to 14 seconds for its initial render. (This is almost instant when running in a WPF app)</p> <p>Each line has a text header that when clicked displays a small summary of data (max, min, mean, std dev) for each of the status icons. clicking this header can take up to 4 seconds to render the summary but is instant in my WPF app.</p> <p>Are there any known tricks for making WPF perform nicely within a native application?</p> <p>[Edit]</p> <p>I have just tried launching it from a large .NET windows forms application using the following code:</p> <pre><code> public bool? ShowWpfDialog(System.Windows.Window window, Form owner) { var helper = new System.Windows.Interop.WindowInteropHelper(window) {Owner = (owner == null) ? IntPtr.Zero : owner.Handle}; return window.ShowDialog(); } </code></pre> <p>I have the same performance issues as when running from the native app. (the .net app also runs native code.)</p> <p>[Edit]</p> <p>When I don't use the WindowInteropHelper the code performs properly:</p> <pre><code> public bool? ShowWpfDialog(System.Windows.Window window, Form owner) { //var helper = new System.Windows.Interop.WindowInteropHelper(window) // {Owner = (owner == null) ? IntPtr.Zero : owner.Handle}; return window.ShowDialog(); } </code></pre> <p>What is the WindowInteropHelper doing that would cause a performance issue?</p> <p>[Edit]</p> <p>Could there be an issue with the way resources are resolved when I load it with an owner using the WindowInteropHelper?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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