<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Blog Alain Zanchetta</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/alainza/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/alainza/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 04:28:54 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Lego to the rescue</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/lego-to-the-rescue</link>
      <pubDate>Sat, 04 Apr 2015 08:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2015/04/04/lego-to-the-rescue/</guid>
      <description><![CDATA[When I write Windows Phone applications, I never find a good position for my phone, especially with...]]></description>
      <content:encoded><![CDATA[<p>When I write Windows Phone applications, I never find a good position for my phone, especially with the USB cable which tends to make the phone rotate in any direction but the one which is usable.</p>
<p>Therefore, I decided this week to build a stand in Lego to always have my phone in a convenient position.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/8468.xDF0_3181.JPG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/8468.xDF0_5F00_3181.JPG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/8468.xDF0_3181.JPG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/8468.xDF0_5F00_3181.JPG" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/8231.xDF0_3185.JPG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/8231.xDF0_5F00_3185.JPG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/8231.xDF0_3185.JPG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/8231.xDF0_5F00_3185.JPG" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/3652.xDF0_3188.JPG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/3652.xDF0_5F00_3188.JPG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/3652.xDF0_3188.JPG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/3652.xDF0_5F00_3188.JPG" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/3276.xDF0_3195.JPG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/3276.xDF0_5F00_3195.JPG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/3276.xDF0_3195.JPG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/3276.xDF0_5F00_3195.JPG" alt="" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Happy PI Day</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/happy-pi-day</link>
      <pubDate>Sun, 15 Mar 2015 12:12:00 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2015/03/15/happy-pi-day/</guid>
      <description><![CDATA[Yesterday, I wanted to celebrate PI Day in my own way, so I wrote this little program during...]]></description>
      <content:encoded><![CDATA[<p>Yesterday, I wanted to celebrate PI Day in my own way, so I wrote this little program during breakfast. Today, I investigated a bit and reduce the number of allocations: this version only does 9 buffer allocations to compute PI with 100 digits.</p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">#include </span></span></span><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;">&lt;iostream&gt;<br /></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">#include </span></span></span><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;">&lt;memory&gt;<br /></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><br />using </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">namespace</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> std;<br /><br /></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">template</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> count&gt;<br /></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">class </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits <span style="color: #000000; font-family: Consolas; font-size: xx-small;">{</span></span></span></span><br /><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; static </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> MaxVal = 10000;<br /><span><span><span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">std::</span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">unique_ptr</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">[]&gt; _blocks;<br /><span><span><span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> _first;<br /><br /></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">public</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">:<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">BunchOfDigits(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> = 0)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">: _first(0), _blocks(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">new </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">[count + 1])<br />&nbsp;&nbsp;&nbsp;&nbsp;<span>{</span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">_blocks[0] = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = 1; i &lt;= count; ++i) _blocks[i] = 0;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span></span></span><br /><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">BunchOfDigits(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">: _first(</span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._first), _blocks(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">new </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">[count + 1])<br />&nbsp;&nbsp;&nbsp;&nbsp;<span>{</span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = 0; i &lt;= count; i++) {<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">_blocks[i] = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[i];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span><br /><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">BunchOfDigits(</span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp;&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span>: _first(</span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._first), _blocks(std::move(</span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks))<br /></span></span><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>{</span></span></span></span></span><br /><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks = </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">nullptr</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span></span></span><br /><br /><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> &amp;</span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">::operator =(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>{</span></span></span></span></span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">_first = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._first;<br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>_blocks.reset(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">new </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">[count + 1]);<br /></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = 0; i &lt;= count; i++) {<br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>_blocks[i] = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[i];<br /></span></span><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> *</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">this</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span></span></span><br /><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">void</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> Copy(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /></span></span><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>{</span></span></span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">_first = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._first;<br /></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = 0; i &lt;= count; i++) {<br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>_blocks[i] = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">other</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[i];<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span><br /><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; operator/=(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>{</span></span></span></span></span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> remainder = 0;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = _first; i &lt;= count; i++) {<br /></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> dividend = remainder * MaxVal + _blocks[i];<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">_blocks[i] = dividend / </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">remainder = dividend % </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">while</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ((_first &lt;= count) &amp;&amp; !_blocks[_first]) _first++;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> *</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">this</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>}</span></span></span></span></span></span></span><br /><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; operator*=(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;<span>{</span></span></span></span></span></span></span><br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> carry = 0;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = count; i &gt;= _first; --i) {<br /></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;"><span><span><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>&nbsp;&nbsp;&nbsp; </span></span></span></span>int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> n = _blocks[i] * </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> + carry;<br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span>_blocks[i] = n % MaxVal;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;carry = n / MaxVal;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ((carry &gt; 0) &amp;&amp; (_first &gt; 0)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span><span style="font-family: Consolas; font-size: xx-small;">_blocks[--_first] = <span style="font-family: Consolas; font-size: xx-small;">carry;<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /></span></span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> *</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">this</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-family: Consolas; font-size: xx-small;">}<br />&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; operator+=(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br />&nbsp;&nbsp;&nbsp; <span>{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> carry = 0;<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> first = (_first &lt; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._first) ? _first : </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._first;<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = count; i &gt;= first; --i) {<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> sum = _blocks[i] + </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[i] + carry;<br /><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">_blocks[i] = sum % </span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">::MaxVal;<br /><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">carry = sum / </span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">::MaxVal;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span>}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">if</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ((carry &gt; 0) &amp;&amp; (_first &gt; 0)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span>_blocks[--first] = carry;<br /><span><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> *</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">this</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span><span><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;}</span><br /><br /></span></span>&nbsp;&nbsp;&nbsp; BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; operator-=(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br />&nbsp;&nbsp;&nbsp; <span style="font-family: Consolas; font-size: xx-small;">{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> carry = 0;<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = count; i &gt;= _first; --i) {<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> n = _blocks[i];<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> m = carry + </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[i];<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">if</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (n &lt; m) {<br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n += MaxVal;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; carry = 1;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">} </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">else</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> {<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; carry = 0;<br /><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: Consolas; font-size: xx-small;">_blocks[i] = n - m;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: Consolas; font-size: xx-small;">}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">while</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ((_first &lt;= count) &amp;&amp; !_blocks[_first]) {<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++</span><span>_first;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span>}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> *</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">this</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">bool</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> IsZero() { </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> _first &gt; count; }<br /><br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">template</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> count&gt;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">friend</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> std::</span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">ostream</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; operator&lt;&lt;(std::</span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">ostream</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; os, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt;&amp; obj);<br /><br /><span style="font-family: Consolas; font-size: xx-small;">};<br /><br /></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">template</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> count&gt;<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; operator/(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt;&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">left</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span style="font-family: Consolas; font-size: xx-small;">{<br />&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; ret = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">left</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">ret /= </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ret;<br /><span>}<br /><br /></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">template</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> count&gt;<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; operator*(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt;&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">right</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span>{<br />&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; ret = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">right</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">ret *= </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ret;<br /><span><span style="font-family: Consolas; font-size: xx-small;">}<br /><br /></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">template</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> count&gt;<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; operator-(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt;&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">left</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt;&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">right</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span><span style="font-family: Consolas; font-size: xx-small;">{<br />&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; ret = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">left</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">ret -= </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">right</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ret;<br /><span><span>}<br /><br /></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">template</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> count&gt;<br /></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">std::</span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">ostream</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; operator&lt;&lt;(std::</span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">ostream</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">os</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt;&amp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /></span></span><span><span><span style="font-family: Consolas; font-size: xx-small;">{</span></span></span><br /><span style="font-family: Consolas; font-size: xx-small;">&nbsp;&nbsp;&nbsp; </span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">os</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> &lt;&lt; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[0] &lt;&lt; </span></span><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;">"."</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">for</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> i = 1; i &lt; count; i++) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> tmp = </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[i] * 10;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> max = 3;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">while</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (tmp &lt; </span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt;::MaxVal &amp;&amp; (max-- &gt; 0)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">os</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> &lt;&lt; </span></span><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;">"0"</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: Consolas; font-size: xx-small;">tmp *= 10;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span><span style="font-family: Consolas; font-size: xx-small;">}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">os</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> &lt;&lt; </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">._blocks[i];<br />&nbsp;&nbsp;&nbsp; <span><span><span>}<br />&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">os</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br /><span><span><span><span style="font-family: Consolas; font-size: xx-small;">}<br /><br /></span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">template</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> count&gt;<br /></span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; Atan_1_over(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">)<br /><span><span><span>{<br />&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">bool</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> plus = </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">true</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> n = 1;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; tmp(1);<br />&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">tmp /= </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; ret(tmp);<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;count&gt; tmp2;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">while</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (!tmp.IsZero()) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: Consolas; font-size: xx-small;">n +=2;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-family: Consolas; font-size: xx-small;">plus = !plus;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&nbsp;tmp /= </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">tmp /= </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">val</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span>tmp2.Copy(tmp);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span>tmp2 /= n;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">if</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> (plus) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret += tmp2;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span><span><span>} </span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">else</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: Consolas; font-size: xx-small;">ret -= tmp2;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><span><span><span><span style="font-family: Consolas; font-size: xx-small;">}<br />&nbsp;&nbsp;&nbsp; <span><span><span><span><span style="font-family: Consolas; font-size: xx-small;">}<br />&nbsp;&nbsp;&nbsp; </span></span></span></span></span></span></span></span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> ret;<br /><span><span><span><span><span>}<br /><br /></span></span></span></span></span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> main(</span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int </span></span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">argc</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">char</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">* </span></span><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;"><span style="color: #808080; font-family: Consolas; font-size: xx-small;">argv</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">[])<br /><span style="font-family: Consolas; font-size: xx-small;">{<br />&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">const </span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">int</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> n = 26;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"><span style="color: #2b91af; font-family: Consolas; font-size: xx-small;">BunchOfDigits</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">&lt;n&gt; pi = 4 * (4 * Atan_1_over&lt;n&gt;(5) - Atan_1_over&lt;n&gt;(239));<br />&nbsp;&nbsp;&nbsp; </span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;">cout &lt;&lt; </span></span><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;"><span style="color: #a31515; font-family: Consolas; font-size: xx-small;">"pi = "</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> &lt;&lt; pi &lt;&lt; endl;<br />&nbsp;&nbsp;&nbsp; </span></span><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;"><span style="color: #0000ff; font-family: Consolas; font-size: xx-small;">return</span></span></span><span style="font-family: Consolas; font-size: xx-small;"><span style="font-family: Consolas; font-size: xx-small;"> 0;<br /><span><span><span><span><span><span style="font-family: Consolas; font-size: xx-small;">}<br /></span></span></span></span></span></span></span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>ListView basics and virtualization concepts</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/listview-basics-and-virtualization-concepts</link>
      <pubDate>Wed, 03 Sep 2014 19:16:00 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2014/09/03/listview-basics-and-virtualization-concepts/</guid>
      <description><![CDATA[ListView is one of the most important of all XAML controls: not only is it used in almost all...]]></description>
      <content:encoded><![CDATA[<div class="WordSection1">
<p class="MsoTitle">ListView is one of the most important of all XAML controls: not only is it used in almost all Windows and Windows Phone applications, but it is a rich control with many possibilities&hellip; and therefore also many possibilities for the application developer to make mistakes which will kill application performance as ListView is generally used to display many items, which multiply the effects of bad practices. I&rsquo;ll try to write a series of article around the ListView, going from standard usage to more advanced scenarios: this is the first article of this series and describe the basic usage of the ListView as well as the essential concepts around virtualization.</p>
<p class="MsoNormal">The first part of this post is a quick recap on ListView basic behavior. It can be skipped by developers who are already familiar with the ListView control and are only interested by virtualization concepts which are presented in the second part of the post.</p>
<p class="MsoNormal">Note: Starting with Windows Phone 8.1 and the concept of Universal Applications, XAML implementation is shared between Windows and Windows Phone (note: I am not speaking of Silverlight application for Windows Phone) and controls such as ListView which are available on both platforms just have a few behavior differences between the two platforms. I will almost exclusively use screenshots from a sample Windows Phone application but unless explicitly stated, everything I present applies to both platforms.</p>
<p class="MsoNormal">Also note that GridView and ListView are basically the same class and have only very few differences. The most obvious one is that ListView uses a linear panel while GridView uses&hellip; a grid panel.</p>
<h1>ListView basics</h1>
<p class="MsoNormal">As its names stands, ListView is made to display lists of items. These items can be in a flat list or in a grouped list (full trees of items are not supported and na&iuml;ve implementations will kill performance; a later article in this series will illustrate some possible approaches to the tree scenario). As of today, ListView should be the preferred control to display these lists, i.e. ListBox should be considered as deprecated as most development efforts now focus on ListView and the associated panels.</p>
<p class="MsoNormal">In the simplest case, a ListView only needs its ItemsSource property to be set to a collection of objects. Each object is displayed inside a ListViewItem and these ListViewItems are positioned by a panel: it is typically the responsibility of the panel to generate a linear or a grid layout. This leads us to three important properties of the ListView:</p>
<ul>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">ItemTemplate:<br />this specifies how each ListViewItem should display the data it represents</span></div>
</li>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">ItemContainerStyle:<br />the ListViewItem&rsquo;s template itself is responsible of the rendering of elements<br />linked to the usage of a list, such as the selection or some interaction<br />feedback (focused element, pointer down, etc).</span></span></div>
</li>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">ItemPanel:<br />specifies the layout of the ListViewItems.</span></span></span></div>
</li>
</ul>
<p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt;">&nbsp;</p>
<p class="MsoNormal">Amongst these properties, ItemTemplate is the only one almost always set. ItemContainerStyle and ItemPanel defaults value are most of time the most efficient choices.</p>
<div style="padding: 1pt 4pt; border: 1pt solid windowtext;">
<p class="MsoNormal" style="padding: 0cm;">NOTE: between Window 8 and Windows 8.1, the default panel for ListView has been changed. New panels have been introduced, ItemsStackPanel and ItemsWrapGrid, and they bring a lot of performance improvements. If you are migrating a Windows 8 application to 8.1, you should double-check all ListView&rsquo;s use of ItemPanel in order to take advantage of the new panels. This is explained with more details in the Virtualization section of this article.</p>
</div>
<p class="MsoNormal">Let&rsquo;s say that we have this (simplified) Wine database model:</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">class </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">Designation</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> Name { </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">get</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">public </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">Region</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> Region { </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">get</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">class </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">Region </span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">string</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> Name { </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">get</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; public </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">List</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">Designation</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&gt; Designations { </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">get</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">class </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">FlatModel </span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; public </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">ObservableCollection</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">Designation</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&gt; Designations { </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">get</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal">The XAML needed to display all wine designations in a flat list would typically be:</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page.Resources</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DataTemplate</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="DesignationFlatTemplate"&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StackPanel</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">TextBlock</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Text</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> FontSize</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="28"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">TextBlock</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Text</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Region</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">.Name}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> FontSize</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="24"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Foreground</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="LightGray"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Margin</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="16,0,0,0"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StackPanel</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DataTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">model</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">FlatModel</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Key</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="VM"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page.Resources</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="TheListView"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> ItemsSource</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Designations</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">,</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Source</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">={</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> VM</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> ItemTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> DesignationFlatTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;"> /&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal"><span style="color: black; line-height: 107%; font-family: consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal">And this would lead to this rendering:</p>
<p class="MsoNormal"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/6644.wp_ss_20140903_0001_47EBC47A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/6644.wp_5F00_ss_5F00_20140903_5F00_0001_5F00_47EBC47A.png"><img style="border: 0px currentColor; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="wp_ss_20140903_0001" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/1351.wp_ss_20140903_0001_thumb_4E9ECDFD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/1351.wp_5F00_ss_5F00_20140903_5F00_0001_5F00_thumb_5F00_4E9ECDFD.png" alt="wp_ss_20140903_0001" width="388" height="644" border="0" /></a></p>
<p class="MsoNormal"><span style="color: black; line-height: 107%; font-family: consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal">For a grouped list, it is necessary to specify the template to be used to display group headers. This is done through the GroupStyle property and specifically its HeaderTemplate:</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView.GroupStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">GroupStyle</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> HeaderTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> RegionTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">HeaderContainerStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> RegionContainerStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"/&gt;</span></p>
<p class="MsoNormal"><span style="background: white; color: blue; line-height: 107%; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; line-height: 107%; font-family: consolas; font-size: 9.5pt;">ListView.GroupStyle</span><span style="background: white; color: blue; line-height: 107%; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal">In order to display a grouped list of wine regions based on the model displayed above, the easiest way is to use a CollectionViewSource wrapper around this collection. The associated XAML would become:</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">&hellip; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page.Resources</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Style</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Key</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="RegionContainerStyle"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> TargetType</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="ListViewHeaderItem"&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Setter</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Property</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="HorizontalContentAlignment"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Value</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Stretch"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Style</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DataTemplate</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Key</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="RegionTemplate"&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Border</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Background</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Red"&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">TextBlock</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Text</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Foreground</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="White"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> FontSize</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="28"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Border</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DataTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DataTemplate</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="DesignationTemplate"&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">TextBlock</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Text</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> FontSize</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="24" /&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DataTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">model</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">GroupedModel</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Key</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="VM"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">CollectionViewSource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Key</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="CVS"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Source</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Regions</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">,</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Source</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">={</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> VM</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> IsSourceGrouped</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="True"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> ItemsPath</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Designations"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page.Resources</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="TheListView"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> ItemsSource</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Source</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">={</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> CVS</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> ItemTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> DesignationTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;"> &gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView.GroupStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">GroupStyle</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> HeaderTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> RegionTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> HeaderContainerStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> RegionContainerStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;"> /&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView.GroupStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">With this result:</p>
<p class="MsoNormal"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/1856.wp_ss_20140903_0003_7C1FEDC0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/1856.wp_5F00_ss_5F00_20140903_5F00_0003_5F00_7C1FEDC0.png"><img style="border: 0px currentColor; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="wp_ss_20140903_0003" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/4011.wp_ss_20140903_0003_thumb_7BB3BACB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/4011.wp_5F00_ss_5F00_20140903_5F00_0003_5F00_thumb_5F00_7BB3BACB.png" alt="wp_ss_20140903_0003" width="388" height="644" border="0" /></a></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Note that in this example, we have two differences between Windows Phone and Windows:</p>
<ul>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">Windows Phone grouped lists are using Sticky Headers: each group header stays on top of the ListView until it has to leave the place to the next header.</span></div>
</li>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">Through HeaderContainerStyle property of the GroupStyle, it is possible on Windows Phone to have full width headers.</span></span></div>
</li>
</ul>
<p class="MsoNormal">&nbsp;</p>
<h1>ListView Virtualization</h1>
<h2>What is virtualization?</h2>
<p class="MsoNormal">What exactly is virtualization? The main idea is that even if a list contains hundreds of element, only a few of them are visible in the same time and therefore it is possible to reduce CPU and memory consumption by creating just the &ldquo;right&rdquo; number of graphical elements: in our wine designation sample, even if the list contains more than 300 designations, only a dozen are visible in the same time.</p>
<p class="MsoNormal">The operation of expanding a DataTemplate and assigning it values from the data list is named realization. In order to reduce the risk of visual glitch during a scroll operation (which would typically be displaying a black area before filling it with ListViewItems), the &ldquo;realization window&rdquo; is larger than the visible part of the ListView.</p>
<p class="MsoNormal"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/0724.realization-window_696AF409.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/0724.realization_2D00_window_5F00_696AF409.png"><img style="border: 0px currentColor; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="realization window" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/6683.realization-window_thumb_1E0B5045.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/6683.realization_2D00_window_5F00_thumb_5F00_1E0B5045.png" alt="realization window" width="501" height="616" border="0" /></a></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">In addition to this notion of minimal or delayed realization of list items, virtualization also means recycling of the realized items: in the above figure, 9 items are realized. If the user scrolls down the list, visible items will change, for example:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/5826.realization-window-down_72C6B93D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/5826.realization_2D00_window_2D00_down_5F00_72C6B93D.png"><img style="border: 0px currentColor; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="realization window down" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/2376.realization-window-down_thumb_04A34D0B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/2376.realization_2D00_window_2D00_down_5F00_thumb_5F00_04A34D0B.png" alt="realization window down" width="417" height="326" border="0" /></a></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">The realization window then needs to be adjusted: the first item below this window needs to be realized while the first item above the window does not need to be realized anymore. In order to accelerate the adjustment of the realization window, the XAML elements associated to the latter item are recycled to display the former. It basically means that they are moved inside the associated panel and have their data context changed to the data item to be realized:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/6507.recycling_2B71634B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/6507.recycling_5F00_2B71634B.png"><img style="border: 0px currentColor; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="recycling" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/metablogapi/8640.recycling_thumb_4715EF41.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23-metablogapi/8640.recycling_5F00_thumb_5F00_4715EF41.png" alt="recycling" width="830" height="477" border="0" /></a></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Of course, as scrolling is smooth and the visible window does not jump from one item to another, the real schema is slightly more complex and in some cases, it is necessary to instantiate a new set of XAML elements as no realized item may be available for recycling (an item partially overlapping the realization window cannot be reused).</p>
<p class="MsoNormal">For the ListView control, virtualization is implemented by the underlying panel. Different panels can have different virtualization strategies. Basically, the panel needs to know the actual size of the ListView control in order to start realizing items. It can then configure the ScrollViewer which is also part of the ListView&rsquo;s template to specify its extent as well as its position. Then it registers a few event handlers to be notified when scrolling happens and requires the virtualization window to be updated.</p>
<h2>Measuring Virtualization efficiency</h2>
<p class="MsoNormal">ListView control has some virtual methods which may be used to analyze how virtualization works in a real application (of course, these methods can also be used for &ldquo;real code&rdquo; <span style="font-family: wingdings;">J</span>):</p>
<ul>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">GetContainerForItemOverride is called when a new ListViewItem needs to be realized.</span></div>
</li>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">PrepareContainerForItemOverride is called when a ListViewItem will be assigned new content</span></span></div>
</li>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">ClearContainerForItemOverride is called when a ListViewItem will stop displaying its current content.</span></span></div>
</li>
</ul>
<p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt;"><span style="font-family: symbol;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;</span></span></p>
<p class="MsoNormal">Basically, tracking the calls to GetContainerForItemOverride allows measuring how virtualization works. New panels such as ItemsStackPanel and ItemsWrapGrid also implement ETW tracing but old panels don&rsquo;t and therefore, in the rest of this article, we will only use GetContainerForItemOverride to check how virtualization performs.</p>
<p class="MsoNormal">Let&rsquo;s implement a &ldquo;DebugListView&rdquo; which overrides GetContainerForItemOverride and PrepareContainerForItemOverride and put it in the previous grouped list page, slightly modified to display statistics:</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">class </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">DebugListView</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> : </span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">ListView </span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">int</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> GetContainerCount { </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">get</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">set</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; public </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">int</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> PrepareContainerCount { </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">get</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">set</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; protected </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">override</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> Windows.UI.Xaml.</span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">DependencyObject</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> GetContainerForItemOverride()</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; {</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetContainerCount++;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">return </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">base</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">.GetContainerForItemOverride();</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; protected </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">override </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">void</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> PrepareContainerForItemOverride(</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">Windows.UI.Xaml.</span><span style="background: white; color: #2b91af; font-family: consolas; font-size: 9.5pt;">DependencyObject</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> element, </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">object</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;"> item)</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; {</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PrepareContainerCount++;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">base</span><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">.PrepareContainerForItemOverride(element, item);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page &hellip;</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid.RowDefinitions</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">RowDefinition</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">RowDefinition</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Height</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Auto"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid.RowDefinitions</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">local</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DebugListView</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="TheListView"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> ItemsSource</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Binding</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Source</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">={</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> CVS</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> ItemTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> DesignationTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;"> &gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView.GroupStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">GroupStyle</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> HeaderTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> RegionTemplate</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> HeaderContainerStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="{</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StaticResource</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> RegionContainerStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">}"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;"> /&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView.GroupStyle</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">local</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DebugListView</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StackPanel</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Orientation</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Horizontal"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Grid.Row</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="1"&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Button</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="StatsButton"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Content</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Stats"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> VerticalAlignment</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Center"</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Click</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="StatsButton_Click"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">TextBlock</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="StatsTextBlock"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> VerticalAlignment</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Center"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StackPanel</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Page</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">And now, let&rsquo;s scroll the ListView once and click on &ldquo;Stats&rdquo; button when we reach the bottom of the list:</p>
<ul>
<li>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">#of calls to GetContainerForItemOverride = 45</span></div>
</li>
<li>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">#of calls to PrepareContainerForItemOverride = 303</span></span></div>
</li>
</ul>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">If the list had had more items (for example a few thousands), only the number of calls to PrepareContainerForItemOverride would raise: preparing 50 items is enough to keep the realization window updated.</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">A quick count of the number of visible items shows that the realization window is three times higher than the ListView itself:</p>
<ul>
<li>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">This can be tuned by changing the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.itemsstackpanel.cachelength.aspx">CacheLength</a>&nbsp;property of ItemsStackPanel or ItemsWrapGrid.</span></div>
</li>
<li>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">And the default value is different in Windows and Windows Phone: the latter has stronger memory constraints and therefore the default value is 2 instead of 4.</span></span></div>
</li>
</ul>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">&nbsp;</p>
<h2>Old panels</h2>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">In the first part of this article, I briefly mentioned that ListView&rsquo;s default panel had been changed between Windows 8 (VirtualizingStackPanel) and Windows 8.1 (ItemsStackPanel). One of the huge differences between these two panels is that ItemsStackPanel &ldquo;understands&rdquo; grouped list while VirtualizingStackPanel does not.</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">&nbsp;</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">What does it mean? VirtualizingStackPanel only manages groups: when it detects that the virtualization window overlaps a group, it realizes this group. It means that if this group has many items, all of them will be realized in the same operation, even if only a few pixels from the group header really overlap the realization window. On the contrary, ItemsStackPanel is aware of the items inside groups and will only realize the items which are in the realization window.</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">&nbsp;</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">Let&rsquo;s run our simple virtualization analysis on a ListView configured to use a VirtualizingStackPanel:</p>
<ul>
<li>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">#of calls to GetContainerForItemOverride = 162</span>&nbsp;</div>
</li>
<li>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">#of calls to PrepareContainerForItemOverride = 327</span></div>
</li>
</ul>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">&nbsp;</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">These number tell a clear message: if you have a ListView (or a GridView), be sure that you are not explicitly setting the associated panel to a VirtualizingStackPanel.</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;">&nbsp;</p>
<h2>Killing virtualization</h2>
<p class="MsoNormal">There are several XAML constructions which can kill virtualization and hence performance. A XAML developer should be aware of these constructions and have the reflex to investigate the behavior of any ListView which seems to be sensible to the number of items in the data collection.</p>
<p class="MsoNormal">As already mentioned, the panel of a ListView virtualizes items by calculating the realization window based on the ListView&rsquo;s actual size. All scenarios which break virtualization are in fact scenarios where the ListView is given all the space it needs to display all its items&hellip;</p>
<p class="MsoNormal">This is for example the case when the ListView is nested inside a non-constraining StackPanel, Grid or ScrollViewer. A typical scenario would be this kind of XAML:</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ScrollViewer</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StackPanel</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Border</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Some awesome header</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Border</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ListView...</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Border</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A non less awesome footer</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Border</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">StackPanel</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">ScrollViewer</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">The StackPanel is vertical and does not constrain its children in this direction. This is also the case for ScrollViewer which gives its child (here the StackPanel) all needed space and then positions it appropriately in its own limits. The ListView will therefore realize all its items (no constraints!) and the page will in the end behave correctly, even if slowly, because the encompassing ScrollViewer will ensure scrolling.</p>
<p class="MsoNormal">If we use our Virtualization analysis on this XAML construction, we get self-explaining numbers:</p>
<ul>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">#of calls to GetContainerForItemOverride = 303</span></div>
</li>
<li>
<div class="MsoNormal"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">#of calls to PrepareContainerForItemOverride = 303</span></span></div>
</li>
</ul>
<p class="MsoNormal">QED Each data item gets its own ListViewItem.</p>
<p class="MsoNormal">Another virtualization killing construction would be:</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid.RowDefinitions</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">RowDefinition</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Height</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Auto"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: black; font-family: consolas; font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">RowDefinition</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Height</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="Auto"/&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;/</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">Grid.RowDefinitions</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&gt;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">&lt;</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">local</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: #a31515; font-family: consolas; font-size: 9.5pt;">DebugListView</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> x</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">:</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;">Name</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="TheListView"</span><span style="background: white; color: red; font-family: consolas; font-size: 9.5pt;"> Grid.Row</span><span style="background: white; color: blue; font-family: consolas; font-size: 9.5pt;">="1"&hellip;/&gt;</span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">As in the previous sample, the ListView is not constrained and will therefore realize all its items. The good news here is that this scenario is easier to detect than the previous one as the ListView won&rsquo;t scroll&hellip; of course, this means that the developer has to test his application with more than a few items!</p>
</div>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/55/49/08/ListViewSamples_Step1.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-55-49-08/ListViewSamples_5F00_Step1.zip">ListViewSamples_Step1.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Techdays 2012</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/techdays-2012</link>
      <pubDate>Tue, 10 Jan 2012 23:34:29 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2012/01/10/techdays-2012/</guid>
      <description><![CDATA[&nbsp;On February 8th, I&rsquo;ll have the pleasure and honor to deliver a talk about &ldquo;modern...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;On February 8th, I&rsquo;ll have the pleasure and honor to deliver <a href="https://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#SessionID=13383a46-f584-49aa-81df-020a1540adf7" target="_blank">a talk about &ldquo;modern C++&rdquo;</a> with Christophe Pichaud (<a title="https://www.windowscpp.net/" href="https://www.windowscpp.net/">https://www.windowscpp.net/</a>) during French Techdays 2012. This is only a 200-level session which targets developers and architects like me who know C++ but haven&rsquo;t been following C++ news carefully for several years, typically because of lack of time.</p>
<p>We will show how a &ldquo;classical&rdquo; C++ piece of code can be updated to take advantage of new C++ features and libraries and finish <em><span style="font-size: xx-small;" size="1">almost</span></em> as simple as the C# equivalent.</p>]]></content:encoded>
    </item>
    <item>
      <title>Couldn't buy Windows Phone 7 Application : error c101c401</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/couldnt-buy-windows-phone-7-application-error-c101c401</link>
      <pubDate>Tue, 14 Jun 2011 23:40:56 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2011/06/14/couldnt-buy-windows-phone-7-application-error-c101c401/</guid>
      <description><![CDATA[Some time ago, I tried to buy an application from my Windows Phone 7 device and got an "Try again...]]></description>
      <content:encoded><![CDATA[<p>Some time ago, I tried to buy an application from my Windows Phone 7 device and got an "Try again later" error message with code <strong>c101c401</strong>.<br />I also tried to buy the same application from my Zune desktop but it failed too, with no details this time.</p>
<p>After calling Zune support, I finally got the solution and I want to share it because the correction is simple and I could have done it if BING had found the solution for me :-)</p>
<p>In fact, a long time ago, I had renamed my default billing account on the billing.microsoft.com site as shown below :</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/2526.capture2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/2526.capture2.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/2526.capture2.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/2526.capture2.png" border="0" /></a></p>
<p>This account has to be named "XBox Live" for Windows Phone purchases to succeed : just click the link below the combo box and you will be able to rename the account, with the setting below, everything is now fine :-)</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/2570.capture%203.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/2570.capture-3.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/2570.capture%203.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/2570.capture-3.png" border="0" /></a></p>
<p>Hope this helps...</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/2703.capture%204.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/2703.capture-4.png"></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Want to try Silverlight 5 without changing your VS 2010 / SL 4 config ? Use Wiki-OS</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/want-to-try-silverlight-5-without-changing-your-vs-2010-sl-4-config-use-wiki-os</link>
      <pubDate>Sun, 22 May 2011 07:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2011/05/22/want-to-try-silverlight-5-without-changing-your-vs-2010-sl-4-config-use-wiki-os/</guid>
      <description><![CDATA[Wiki-OS now supports Silverlight 5 !

There is even a application category to help you find...]]></description>
      <content:encoded><![CDATA[<p><a href="https://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/https:/www.wiki-os.prg" title="Wiki-OS">Wiki-OS</a> now supports Silverlight 5 !</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/5102.wikios.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/5102.wikios.png" border="0" /></p>
<p>There is even a application category to help you find current SL 5 applications :</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/3438.SL5category.PNG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/3438.SL5category.PNG"><img height="234" width="414" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/41/23/3438.SL5category.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-41-23/3438.SL5category.PNG" border="0" /></a></p>
<p>As of today, the two only samples available are two 3D applications, one of them being a Rubik's Cube I initially wrote for Windows Phone 7 (but never tried to publish).</p>
<p>Note : if you want to launch a wiki-os application from another web site, you can use a direct URL, for example : <a href="https://www.wiki-os.org/Rubik3D/Rubik3D">https://www.wiki-os.org/Rubik3D/Rubik3D</a>&nbsp;in the case of the 3D Rubik's cube.To get the exact URL from a running application, click on the "share / embed" button in the title bar.</p>
<p>Of course, even if Wiki-OS allows you to build Silverlight 5 applications without having to update your Visual Studio 2010 installation, you nevertheless have to install the Silverlight 5 runtime as Wiki-OS !</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>IE 9  helped me find a bug...</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/ie-9-helped-me-find-a-bug</link>
      <pubDate>Wed, 16 Mar 2011 02:39:31 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2011/03/16/ie-9-helped-me-find-a-bug/</guid>
      <description><![CDATA[I have been using a homemade Internet explorer band to track ebay auctions in IE (mostly dedicated...]]></description>
      <content:encoded><![CDATA[<p>I have been using a homemade Internet explorer band to track ebay auctions in IE (mostly dedicated chess computers and calculators) and this band (based on a windows form) has been working fine in several versions of IE. Yesterday, I installed IE9 and oops, my band did not show anymore :-(</p>
<p>After a small debugging session, I found that my IDeskBand::GetBandInfo implementation was not correct : so if your band does not seem to work correcly in IE9... check your own code...</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Article d'introduction à Windows Identity Foundation dans le dernier Programmez!</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/article-dintroduction-windows-identity-foundation-dans-le-dernier-programmez</link>
      <pubDate>Thu, 03 Mar 2011 00:17:43 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2011/03/03/article-dintroduction-windows-identity-foundation-dans-le-dernier-programmez/</guid>
      <description><![CDATA[Windows Identity Foundation est un ensemble de biblioth&egrave;ques .NET facilitant la gestion de la...]]></description>
      <content:encoded><![CDATA[<p>Windows Identity Foundation est un ensemble de biblioth&egrave;ques .NET facilitant la gestion de la &nbsp;f&eacute;d&eacute;ration d'identit&eacute; dans les sites asp.net. Le dernier num&eacute;ro de Programmez! (139) contient un petit article que j'ai &eacute;crit cet automne sur cette technologie tr&egrave;s int&eacute;ressante.</p>
<p>Pour en savoir plus, rendez-vous en kiosque.</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Restoring VS 2010 Dialogs</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/restoring-vs-2010-dialogs</link>
      <pubDate>Sat, 16 Oct 2010 07:07:59 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2010/10/16/restoring-vs-2010-dialogs/</guid>
      <description><![CDATA[Two weeks ago, I installed Windows 7 x64 and VS 2010 on my new Lenovo laptop. A few days later,...]]></description>
      <content:encoded><![CDATA[<p>Two weeks ago, I installed Windows 7 x64 and VS 2010 on my new Lenovo laptop. A few days later, VS2010 "Open Project" and "Add Reference" dialogs did not open anymore ! I still could create new projects as well as open existing ones from the shell but it was really painful to use. Expression Blend 4 has the same problem, no more "open project" dialog.</p>
<p>After a few searches on the web, I found the cause of the problem and its solution : I had disabled the "Tablet PC input service" because my laptop is not a tablet pc and I did not see why this service should run. Reenabling the service and starting it immediately caused VS 2010 as well as Expression Blend 4 to work fine again...</p>]]></content:encoded>
    </item>
    <item>
      <title>I wish I could assist to Mix 10</title>
      <link>https://docs.microsoft.com/archive/blogs/alainza/i-wish-i-could-assist-to-mix-10</link>
      <pubDate>Wed, 03 Mar 2010 07:48:00 GMT</pubDate>
      <dc:creator><![CDATA[Alainza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alainza/2010/03/03/i-wish-i-could-assist-to-mix-10/</guid>
      <description><![CDATA[Cool sessions, cool tools :...]]></description>
      <content:encoded><![CDATA[<P>Cool sessions, cool tools : </P>
<P><A href="https://live.visitmix.com/News/Exclusive-Windows-Phone-7-Series-Offer-for-MIX10-Attendees-WP7">https://live.visitmix.com/News/Exclusive-Windows-Phone-7-Series-Offer-for-MIX10-Attendees-WP7</A></P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
  </channel>
</rss>