Why using UserControl inside DataTemplate is slower than direct xaml?
<p>I have code as this one:</p>

<pre><code>&lt;ListBox ItemsSource="{Binding Items}"&gt;
    &lt;ListBox.ItemTemplate&gt;
        &lt;DataTemplate DataType="{x:Type local:MyViewModel}"&gt;

           &lt;!-- xaml is typed here directly --&gt;
           &lt;Border&gt;
               ...
           &lt;/Border&gt;

        &lt;/DataTemplate&gt;
    &lt;/ListBox.ItemTemplate&gt;
&lt;/ListBox&gt;
</code></pre>

<p>And xaml inside the DataTemplate is big (more than 200 lines).</p>

<p>I want to move xaml which is inside the DataTemplate into a separate UserControl to make it easier to edit and maintain. I do next:</p>

<pre><code>&lt;ListBox ItemsSource="{Binding Items}"&gt;
    &lt;ListBox.ItemTemplate&gt;
        &lt;DataTemplate DataType="{x:Type local:MyViewModel}"&gt;

            &lt;!-- xaml is moved to separate UserControl --&gt;
            &lt;local:MyViewModelUserControl /&gt;

        &lt;/DataTemplate&gt;
    &lt;/ListBox.ItemTemplate&gt;
&lt;/ListBox&gt;
</code></pre>

<p>The issue I run into is that rendering/processing the second code (with UserControl) takes about 2 times longer than the 1st code. Any ideas how to deal with it?</p>

<p>NOTE: I'm moving not the ListBox, but the xaml which is inside the DataTemplate. The reason is not to reuse this code, but to minimize the main file where the ListBox is placed. Other thing is that I have several DataTemplates inside the ListBox (for several ViewModels) and the xaml is really huge. That's why I want to move this xaml (which is inside the DataTemplate) to a separate control.</p>