<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Silverlight Controls and Silverlight Toolkit</title><link>http://forums.silverlight.net/forums/35.aspx</link><description>Discussions around using and developing Silverlight controls and the Silverlight Toolkit</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/240875.aspx</link><pubDate>Thu, 02 Jul 2009 15:59:38 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:240875</guid><dc:creator>ld1453</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/240875.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=240875</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Silverlight 3 seems to work as I expected it to, applying styles to children of even if they might have been changed by the parents style.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/225915.aspx</link><pubDate>Thu, 28 May 2009 15:48:19 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:225915</guid><dc:creator>ld1453</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/225915.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=225915</wfw:commentRss><description>&lt;p&gt;I understand what you mean but I would suggest that lazy evaluation is not the proper approach to use here because getting the children relies on other processes (ApplyTemplate). In this case, the children themselves don&amp;#39;t change, they just haven&amp;#39;t been assigned to the Content property of the new ScrollContentPresenter. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Also, what would be the drawback of going ahead and styling the &amp;#39;old&amp;#39; children (if they indeed change) anyway? If ApplyMode=OneTime, the &amp;#39;new&amp;#39; children won&amp;#39;t get styled anyway and if ApplyMode=Auto we&amp;#39;re in the same situation as now.&amp;nbsp; The cost is traversing and styling children which may never be used but the benefit is not requiring ApplyMode=Auto (or any of the extra effort coding work-arounds) for children that don&amp;#39;t actually change.&lt;/p&gt;&lt;p&gt;Don&amp;#39;t you agree? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/225492.aspx</link><pubDate>Wed, 27 May 2009 23:17:23 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:225492</guid><dc:creator>jahusain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/225492.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=225492</wfw:commentRss><description>&lt;p&gt;Yeah under the circumstances the gradual drill-down behavior of ISM is correct.&amp;nbsp; Apply the style to a parent may change its children.&amp;nbsp; In this case by lazily evaluating the stream of children is best so that we get the new children instead of the old cached one.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s almost always a good idea to avoid Auto and just manually apply the style using ImplicitStyleManager.Apply until you are certain it&amp;#39;s been applied to all items.&amp;nbsp; That or you can use Auto and switch to OneTime (or None) after you&amp;#39;re sure it&amp;#39;s been applied.&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/225490.aspx</link><pubDate>Wed, 27 May 2009 23:09:54 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:225490</guid><dc:creator>ld1453</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/225490.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=225490</wfw:commentRss><description>&lt;p&gt;Ah, you&amp;#39;re good. I&amp;#39;m understanding the problem much better.&amp;nbsp; The style applied to the ScrollViewer doesn&amp;#39;t change the content directly, but it does redefine the Template.&amp;nbsp; If I&amp;#39;m correct, the reason ISM isn&amp;#39;t finding any children for the ScrollViewer is because it doesn&amp;#39;t have any!&amp;nbsp; In applying the new template it also gets a new ScrollContentPresenter whose Content won&amp;#39;t be assigned until the next ApplyTemplate call.&lt;/p&gt;&lt;p&gt;This can be fixed by setting the ISM ApplyMode to Auto so that when the Content is assigned and a LayoutUpdated event produced, ISM will come back and style the Content correctly. I&amp;#39;m not sure that&amp;#39;s the best approach though because all the other things I&amp;#39;ve read say that the overhead for ApplyMode=Auto is considerable and it can can also be fixed using the suggestion stated before.&amp;nbsp; What do you think?&lt;/p&gt;&lt;p&gt;I&amp;#39;m not sure if this has anything to do with having to use ApplyMode=Auto on ItemsControl but I&amp;#39;ll take a look at it tomorrow morning and update this.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here&amp;#39;s the &lt;a href="http://www.waywardscholar.com/ScrollViewerThemeProblem.zip"&gt;project&lt;/a&gt;. I&amp;#39;m still using Silverlight 2.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/225455.aspx</link><pubDate>Wed, 27 May 2009 21:25:35 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:225455</guid><dc:creator>jahusain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/225455.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=225455</wfw:commentRss><description>&lt;p&gt;Before you log an issue I&amp;#39;d like to know what style you apply to scrollviewer.&amp;nbsp; Does that style change the content property, thereby removing children or do anything else that might cause the children to disappear.&amp;nbsp; Also which version of Silverlight are you using?&amp;nbsp; Can you send a small repro?&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks very much,&lt;/p&gt;
&lt;p&gt;Jafar&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/225436.aspx</link><pubDate>Wed, 27 May 2009 21:14:06 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:225436</guid><dc:creator>ld1453</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/225436.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=225436</wfw:commentRss><description>&lt;p&gt;That&amp;#39;s correct, applying a style to a parent makes a child disappear, or more precisely, VisualTreeHelper.GetChild() no longer can no longer returns them. There aren&amp;#39;t any exceptions, chlidren just don&amp;#39;t get styled.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here&amp;#39;s a very simple example (I uploaded the project &lt;a href="http://www.waywardscholar.com/ScrollViewerThemeProblem.zip"&gt;here&lt;/a&gt;):&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;    &amp;lt;&lt;span class="tag"&gt;Grid&lt;/span&gt;&lt;span class="attr"&gt;  x:Name=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt;&lt;span class="attr"&gt; theme:ImplicitStyleManager.ApplyMode=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;OneTime&amp;quot;&lt;/span&gt;&lt;span class="attr"&gt; theme:ImplicitStyleManager.ResourceDictionaryUri=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;themes/Classic.xaml&amp;quot;&lt;/span&gt;&amp;gt;
        &amp;lt;&lt;span class="tag"&gt;Grid.RowDefinitions&lt;/span&gt;&amp;gt;
            &amp;lt;&lt;span class="tag"&gt;RowDefinition&lt;/span&gt; /&amp;gt;
            &amp;lt;&lt;span class="tag"&gt;RowDefinition&lt;/span&gt; /&amp;gt;
        &amp;lt;/&lt;span class="tag"&gt;Grid.RowDefinitions&lt;/span&gt;&amp;gt;
        &amp;lt;&lt;span class="tag"&gt;Button&lt;/span&gt;&lt;span class="attr"&gt; x:Name=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;Button1&amp;quot;&lt;/span&gt;&lt;span class="attr"&gt; Content=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;Styled Button&amp;quot;&lt;/span&gt; /&amp;gt;
        &amp;lt;&lt;span class="tag"&gt;ScrollViewer&lt;/span&gt;&lt;span class="attr"&gt; x:Name=&amp;quot;ScrollViewer1&amp;quot; Grid.Row=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;&amp;gt;
            &amp;lt;&lt;span class="tag"&gt;Button&lt;/span&gt;&lt;span class="attr"&gt; x:Name=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;Button2&amp;quot;&lt;/span&gt;&lt;span class="attr"&gt; Content=&lt;/span&gt;&lt;span class="attrv"&gt;&amp;quot;Unstyled Button&amp;quot;&lt;/span&gt; /&amp;gt;
        &amp;lt;/&lt;span class="tag"&gt;ScrollViewer&lt;/span&gt;&amp;gt;
    &amp;lt;/&lt;span class="tag"&gt;Grid&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;p&gt;If you set a breakpoint at Line 552 at the foreach loop of ImplicitStyleManger.PropagateStyles() you can ask for elementsToStyleAndDictionaries to be enumerated.&amp;nbsp; As you might expect, it lists all the elements as defined in XAML.&amp;nbsp; &lt;/p&gt;&lt;p&gt;As it continues ISM goes through styling first LayoutRoot, then Button1, then ScrollViewer1. Then the next in the next iteration the enumerator cannot find any children for ScrollViewer1 even though it very clearly found it before the a style was applied to ScrollViewer1. If you instruct the debugger to skip the statement applying the style for ScrollViewer1, Button2 is again found and styled correctly. I&amp;#39;m not sure what happens to cause VisualTreeHelper to not see the children anymore but it happens. &lt;/p&gt;&lt;p&gt;So we&amp;#39;re in agreement it&amp;#39;s best to take a copy of the elements before applying the styles? You don&amp;#39;t see any major problems with it? If so, I&amp;#39;ll open up an Issue on their tracker.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/225398.aspx</link><pubDate>Wed, 27 May 2009 19:53:14 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:225398</guid><dc:creator>jahusain</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/225398.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=225398</wfw:commentRss><description>&lt;p&gt;If I&amp;#39;m understanding you correctly you are saying that applying a style to a parent in the sequence of FrameworkElements might cause a child to disappear.&amp;nbsp; You are indeed correct and it would likely be best if we took a copy of the stream into a list.&amp;nbsp; Out of curiousity did you experience an exception?&amp;nbsp; If so, what was it?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jafar&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/225173.aspx</link><pubDate>Wed, 27 May 2009 13:49:26 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:225173</guid><dc:creator>ld1453</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/225173.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=225173</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hmmm... I think we may be talking about different things.&amp;nbsp; I meant the PropagateStyles priviate method defined in the class ImplicitStyleManager. &lt;/p&gt;&lt;p&gt;But either way, you were correct in that it&lt;i&gt;doesn&amp;#39;t &lt;/i&gt;work and my question is why it was made to not work. The way it is defined now the items the enumerator would return in the foreach loop can and do change as styles are applied. And since it is a DepthFirst approach setting a style on a parent could stop a child from being styled properly. My question is, was it made that way on purpose? &lt;/p&gt;&lt;p&gt;I&amp;#39;ve changed it in my local copy to enumerate the entire tree before any styles are applied (by creating a List&amp;lt;FrameworkElement&amp;gt;) and then start applying styles. I&amp;#39;ve yet to see any ill effects but I assume the people who wrote it know more than I do so I thought I&amp;#39;d ask the community here.&lt;/p&gt;&lt;p&gt;Thanks for the response, Jonathan. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/224979.aspx</link><pubDate>Wed, 27 May 2009 06:22:30 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:224979</guid><dc:creator>Jonathan Shen – MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/224979.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=224979</wfw:commentRss><description>&lt;p&gt;Hi Ld1453,&lt;/p&gt;
&lt;p&gt;Actually, as far as I know,&amp;nbsp;PropagateStyles is not supported on Silverlight 2.&amp;nbsp; If you want to apply style to controls, please reference to these articles.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://themechanicalbride.blogspot.com/2008/11/using-implicitstylemanager-and-theme.html"&gt;http://themechanicalbride.blogspot.com/2008/11/using-implicitstylemanager-and-theme.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.nikhilk.net/Silverlight-Themes.aspx"&gt;http://www.nikhilk.net/Silverlight-Themes.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jonathan&lt;/p&gt;</description></item><item><title>Re: ISM TraverseDepthFirst Implementation</title><link>http://forums.silverlight.net/forums/thread/222942.aspx</link><pubDate>Thu, 21 May 2009 22:48:08 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:222942</guid><dc:creator>ld1453</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/222942.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=222942</wfw:commentRss><description>&lt;p&gt;Maybe a better question is &amp;quot;Why does ImplicitStyleManager iterate over elements that it is changing?&amp;quot;&lt;/p&gt;&lt;p&gt;Every iteration of the foreach loop in ImplicitStyleManager.PropagateStyles() could apply a style to an element, and in doing so, could change the remaining enumeration. I&amp;#39;m sorry if that&amp;#39;s not so clear.&lt;/p&gt;&lt;p&gt;Why not&amp;nbsp; place the Tuples inside IEnumberable elementsToStyleAndDictionaries inside a fixed storage, like a List, and &lt;i&gt;then&lt;/i&gt; loop though them setting the styles?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>ImplicitStyleManager Propogate Correclty?</title><link>http://forums.silverlight.net/forums/thread/222924.aspx</link><pubDate>Thu, 21 May 2009 21:31:56 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:222924</guid><dc:creator>ld1453</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/222924.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=222924</wfw:commentRss><description>[EDIT: Clarified my question below]&lt;br /&gt;</description></item></channel></rss>