<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Are there any tricks that will help me improve TreeView&#8217;s performance? &#8211; Part III</title>
	<atom:link href="http://bea.stollnitz.com/blog/?feed=rss2&#038;p=45" rel="self" type="application/rss+xml" />
	<link>http://bea.stollnitz.com/blog/?p=45</link>
	<description>on Silverlight and WPF</description>
	<lastBuildDate>Thu, 22 Jul 2010 20:56:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-169999</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Thu, 19 Nov 2009 00:35:34 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-169999</guid>
		<description>That is certainly one solution to the problem - there are others. 
As with almost everything in WPF, it&#039;s a compromise.
Thanks for posting!</description>
		<content:encoded><![CDATA[<p>That is certainly one solution to the problem &#8211; there are others.<br />
As with almost everything in WPF, it&#8217;s a compromise.<br />
Thanks for posting!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-168737</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 04 Nov 2009 23:33:51 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-168737</guid>
		<description>I&#039;m not sure I understand why the thumb size is an issue.  If the thumb size remains constant, why not simply have a scroll speed that is not uniform?  For example, much like item based scrolling, I calculate marks along the scrollbar that represent each item, regardless of how large that item actually is.  When scrolling in the view however, I could simply move at a constant rate, say, 30pixels when using the scroll wheel, then when the user is dragging the scrollbar and moving the scrollbar through a section dedicated to say item #30, which when we render we find out is quite large, we just change the rate at which we are moving the viewport content compared to the pixels the scrollbar is moved.

So, say we have 10 items that just happen to be 30px high each, except for #5 which is 90px high.  Our Scrollbar has 10 sections representing the start and end of each item (logically, because we don&#039;t know the height yet).  Each time the scrollwheel is moved, we move 30px, and we discover a new item, it&#039;s realized and a UI component is generated.  We keep going, the scrollbar is moving along one section at a time with each click of our scrollwheel.

When we reach 5, we generate the UI and find out the item is actually 90px high.  Now, I scroll again with the scrollwheel another 30px go by, but the scrollbar, instead of moving to the next logical tick is computing how far to move based on distance through the current item, so it only moves 1/3 of the way through item 5&#039;s position on the scrollbar.

So basically it&#039;s like having different densities along the scrollbar.

Now...If i knew where to modify the code to make this happen, that would be awesome :)</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure I understand why the thumb size is an issue.  If the thumb size remains constant, why not simply have a scroll speed that is not uniform?  For example, much like item based scrolling, I calculate marks along the scrollbar that represent each item, regardless of how large that item actually is.  When scrolling in the view however, I could simply move at a constant rate, say, 30pixels when using the scroll wheel, then when the user is dragging the scrollbar and moving the scrollbar through a section dedicated to say item #30, which when we render we find out is quite large, we just change the rate at which we are moving the viewport content compared to the pixels the scrollbar is moved.</p>
<p>So, say we have 10 items that just happen to be 30px high each, except for #5 which is 90px high.  Our Scrollbar has 10 sections representing the start and end of each item (logically, because we don&#8217;t know the height yet).  Each time the scrollwheel is moved, we move 30px, and we discover a new item, it&#8217;s realized and a UI component is generated.  We keep going, the scrollbar is moving along one section at a time with each click of our scrollwheel.</p>
<p>When we reach 5, we generate the UI and find out the item is actually 90px high.  Now, I scroll again with the scrollwheel another 30px go by, but the scrollbar, instead of moving to the next logical tick is computing how far to move based on distance through the current item, so it only moves 1/3 of the way through item 5&#8217;s position on the scrollbar.</p>
<p>So basically it&#8217;s like having different densities along the scrollbar.</p>
<p>Now&#8230;If i knew where to modify the code to make this happen, that would be awesome :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-154434</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Sat, 11 Jul 2009 19:55:16 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-154434</guid>
		<description>Hi Sean,

For item-based scrolling, the thumb size is calculated based on the total amount of items and the number of displayed items. If the items have different sizes, it may happen that the number of items displayed differs as you scroll. This causes the size of the thumb to change too.

You may be able to retemplate the ScrollBar to override the height of the thumb, and then do the calculations yourself. I haven&#039;t tried this, it&#039;s just the first idea that comes to mind. If you&#039;re able to implement this idea successfully, send me email.

Bea</description>
		<content:encoded><![CDATA[<p>Hi Sean,</p>
<p>For item-based scrolling, the thumb size is calculated based on the total amount of items and the number of displayed items. If the items have different sizes, it may happen that the number of items displayed differs as you scroll. This causes the size of the thumb to change too.</p>
<p>You may be able to retemplate the ScrollBar to override the height of the thumb, and then do the calculations yourself. I haven&#8217;t tried this, it&#8217;s just the first idea that comes to mind. If you&#8217;re able to implement this idea successfully, send me email.</p>
<p>Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-153982</link>
		<dc:creator>Sean</dc:creator>
		<pubDate>Thu, 09 Jul 2009 08:38:07 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-153982</guid>
		<description>Yes, you&#039;re right. I&#039;m considering the interesting question. 
But let&#039;s put aside the Virtualization&amp;Pixel-Scrolling problem, and make the scenario simpler first,  it seems the ListBox&#039;s thumb length will not be correct unless I set ScrollViewer.CanContentScroll=&quot;False&quot;, while I&#039;ve changed the ItemsPanel of the ListBox with StackPanel, it&#039;s nothing about Virtualization.

Code Snippet:
    
&lt;ListBox ScrollViewer.CanContentScroll=&quot;True&quot;&gt;
        &lt;Button Height=&quot;50&quot;&gt;Button 1&lt;/Button&gt;
        &lt;Button Height=&quot;150&quot;&gt;Button 2&lt;/Button&gt;
        &lt;Button Height=&quot;300&quot;&gt;Button 3&lt;/Button&gt;
        &lt;Button Height=&quot;50&quot;&gt;Button 4&lt;/Button&gt;
        &lt;Button Height=&quot;50&quot;&gt;Button 5&lt;/Butto&gt;
        &lt;ListBox.ItemsPanel&gt;
            &lt;ItemsPanelTemplate&gt;
                &lt;StackPanel /&gt;
            &lt;/ItemsPanelTemplate&gt;
        &lt;/ListBox.ItemsPanel&gt;
    &lt;/ListBox&gt;
 
Here&#039;s the question, is it possible to make the thumb length correct with no consideration about the Virtualization?

Regards,
Sean</description>
		<content:encoded><![CDATA[<p>Yes, you&#8217;re right. I&#8217;m considering the interesting question.<br />
But let&#8217;s put aside the Virtualization&amp;Pixel-Scrolling problem, and make the scenario simpler first,  it seems the ListBox&#8217;s thumb length will not be correct unless I set ScrollViewer.CanContentScroll=&#8221;False&#8221;, while I&#8217;ve changed the ItemsPanel of the ListBox with StackPanel, it&#8217;s nothing about Virtualization.</p>
<p>Code Snippet:</p>
<p>&lt;ListBox ScrollViewer.CanContentScroll=&#8221;True&#8221;&gt;<br />
        &lt;Button Height=&#8221;50&#8243;&gt;Button 1&lt;/Button&gt;<br />
        &lt;Button Height=&#8221;150&#8243;&gt;Button 2&lt;/Button&gt;<br />
        &lt;Button Height=&#8221;300&#8243;&gt;Button 3&lt;/Button&gt;<br />
        &lt;Button Height=&#8221;50&#8243;&gt;Button 4&lt;/Button&gt;<br />
        &lt;Button Height=&#8221;50&#8243;&gt;Button 5&lt;/Butto&gt;<br />
        &lt;ListBox.ItemsPanel&gt;<br />
            &lt;ItemsPanelTemplate&gt;<br />
                &lt;StackPanel /&gt;<br />
            &lt;/ItemsPanelTemplate&gt;<br />
        &lt;/ListBox.ItemsPanel&gt;<br />
    &lt;/ListBox&gt;</p>
<p>Here&#8217;s the question, is it possible to make the thumb length correct with no consideration about the Virtualization?</p>
<p>Regards,<br />
Sean</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-153842</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Wed, 08 Jul 2009 16:01:23 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-153842</guid>
		<description>Hi Sean,

Unfortunately there is no easy way to work around that limitation. The only way would be for you to re-implement significant portions of the current virtualization code. And if you decide to re-implement portions of our code to allow virtualization with pixel-based scrolling, you will have to solve an interesting problem: How do you determine the size of the thumb when you only know the height of the items visible in the ListBox? Remember that with UI virtualization you won&#039;t have access to the height of most ListBoxItems.

Bea</description>
		<content:encoded><![CDATA[<p>Hi Sean,</p>
<p>Unfortunately there is no easy way to work around that limitation. The only way would be for you to re-implement significant portions of the current virtualization code. And if you decide to re-implement portions of our code to allow virtualization with pixel-based scrolling, you will have to solve an interesting problem: How do you determine the size of the thumb when you only know the height of the items visible in the ListBox? Remember that with UI virtualization you won&#8217;t have access to the height of most ListBoxItems.</p>
<p>Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-153767</link>
		<dc:creator>Sean</dc:creator>
		<pubDate>Wed, 08 Jul 2009 06:21:02 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-153767</guid>
		<description>Hi, Bea;

It&#039;s a question related to the ListBox&#039;s Virtualization.
As you know, the ScrollViewer.CanContentScroll has to be set true to ensure the Virtualization is On, right? But this comes to a problem, only logical scrolling could works but not pixel-based. When the ListBoxItems&#039; height are not always the same, the length of the vertical scrollbar thumb&#039;s behavior becomes longer and shorter when you scroll the listbox. I&#039;m wondering if there&#039;s a way to make the physical scrolling when the Virtualization is On.

Thanks.
Sean</description>
		<content:encoded><![CDATA[<p>Hi, Bea;</p>
<p>It&#8217;s a question related to the ListBox&#8217;s Virtualization.<br />
As you know, the ScrollViewer.CanContentScroll has to be set true to ensure the Virtualization is On, right? But this comes to a problem, only logical scrolling could works but not pixel-based. When the ListBoxItems&#8217; height are not always the same, the length of the vertical scrollbar thumb&#8217;s behavior becomes longer and shorter when you scroll the listbox. I&#8217;m wondering if there&#8217;s a way to make the physical scrolling when the Virtualization is On.</p>
<p>Thanks.<br />
Sean</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-6287</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Fri, 02 Nov 2007 08:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-6287</guid>
		<description>Hi Adolfo,

Yes, that is supported. Here is the xaml for that:

&lt;Window.Resources&gt;
&lt;Style x:Key=&quot;SpStyle&quot; TargetType=&quot;{x:Type TextBox}&quot;&gt;
&lt;Setter Property=&quot;FontSize&quot; Value=&quot;16&quot; /&gt;
&lt;Setter Property=&quot;Text&quot; Value=&quot;{Binding RelativeSource={RelativeSource Self}, Path=FontSize}&quot;/&gt;
&lt;/Style&gt;
&lt;/Window.Resources&gt;

&lt;StackPanel&gt;
&lt;TextBox Style=&quot;{StaticResource SpStyle}&quot;/&gt;
&lt;/StackPanel&gt;

Thanks,
Bea</description>
		<content:encoded><![CDATA[<p>Hi Adolfo,</p>
<p>Yes, that is supported. Here is the xaml for that:</p>
<p>&lt;Window.Resources&gt;<br />
&lt;Style x:Key=&#8221;SpStyle&#8221; TargetType=&#8221;{x:Type TextBox}&#8221;&gt;<br />
&lt;Setter Property=&#8221;FontSize&#8221; Value=&#8221;16&#8243; /&gt;<br />
&lt;Setter Property=&#8221;Text&#8221; Value=&#8221;{Binding RelativeSource={RelativeSource Self}, Path=FontSize}&#8221;/&gt;<br />
&lt;/Style&gt;<br />
&lt;/Window.Resources&gt;</p>
<p>&lt;StackPanel&gt;<br />
&lt;TextBox Style=&#8221;{StaticResource SpStyle}&#8221;/&gt;<br />
&lt;/StackPanel&gt;</p>
<p>Thanks,<br />
Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adolfo Wiernik</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-6285</link>
		<dc:creator>Adolfo Wiernik</dc:creator>
		<pubDate>Fri, 02 Nov 2007 08:42:09 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-6285</guid>
		<description>Hi Beatriz, I love binding in WPF and I follow your blog very closely... thanks for all the great tips and info! 

I have a quick one.... is it possible to bind against a Setter&#039;s value in a Style? 

Say I have a Textbox with a Style set, but the in the Text property I want to show a value coming from the Style, for example the FontSize..... any tips? 

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi Beatriz, I love binding in WPF and I follow your blog very closely&#8230; thanks for all the great tips and info! </p>
<p>I have a quick one&#8230;. is it possible to bind against a Setter&#8217;s value in a Style? </p>
<p>Say I have a Textbox with a Style set, but the in the Text property I want to show a value coming from the Style, for example the FontSize&#8230;.. any tips? </p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-757</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Mon, 01 Oct 2007 18:48:53 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-757</guid>
		<description>Hi Marlon,

That&#039;s awesome! I didn&#039;t download the code, but by reading the post it sounds great!
I&#039;m glad you&#039;re thinking about these problems, as good solution greatly benefit the WPF community!

Thanks a lot!
Bea</description>
		<content:encoded><![CDATA[<p>Hi Marlon,</p>
<p>That&#8217;s awesome! I didn&#8217;t download the code, but by reading the post it sounds great!<br />
I&#8217;m glad you&#8217;re thinking about these problems, as good solution greatly benefit the WPF community!</p>
<p>Thanks a lot!<br />
Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marlon Grech</title>
		<link>http://bea.stollnitz.com/blog/?p=45&#038;cpage=1#comment-754</link>
		<dc:creator>Marlon Grech</dc:creator>
		<pubDate>Mon, 01 Oct 2007 18:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=45#comment-754</guid>
		<description>Hi Bea,

How are you? hope you had a nice weekend :)

As promised I re-wrote the TreeListBox with the new idea that I had... I was really amazed to see, how much better the performace (+ memory) is with the new implementation(compored with the old implementation).... have a look at it and give me your feedback if you have 10 minutes free...
http://marlongrech.wordpress.com/2007/10/01/virtualizing-treeview-aka-treelistbox-v20/

With this new version I am using more the VirtualizationStackPanel and beleive me the difference is really good... I think who ever created the VirtualizingStackPanel did a great job!!!

Any bugs or suggestions please send an email at marlongrech@gmail.com

Thanks a lot :)
Hope to hear from you soon

Regards
Marlon</description>
		<content:encoded><![CDATA[<p>Hi Bea,</p>
<p>How are you? hope you had a nice weekend :)</p>
<p>As promised I re-wrote the TreeListBox with the new idea that I had&#8230; I was really amazed to see, how much better the performace (+ memory) is with the new implementation(compored with the old implementation)&#8230;. have a look at it and give me your feedback if you have 10 minutes free&#8230;<br />
<a href="http://marlongrech.wordpress.com/2007/10/01/virtualizing-treeview-aka-treelistbox-v20/" rel="nofollow">http://marlongrech.wordpress.com/2007/10/01/virtualizing-treeview-aka-treelistbox-v20/</a></p>
<p>With this new version I am using more the VirtualizationStackPanel and beleive me the difference is really good&#8230; I think who ever created the VirtualizingStackPanel did a great job!!!</p>
<p>Any bugs or suggestions please send an email at <a href="mailto:marlongrech@gmail.com">marlongrech@gmail.com</a></p>
<p>Thanks a lot :)<br />
Hope to hear from you soon</p>
<p>Regards<br />
Marlon</p>
]]></content:encoded>
	</item>
</channel>
</rss>
