<?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>Report a Silverlight Bug</title><link>http://forums.silverlight.net/forums/28.aspx</link><description>Found a bug in Silverlight? Use this forum to describe the bug and the code or steps to reproduce it.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: Event model and initialization with custom controls</title><link>http://forums.silverlight.net/forums/thread/105403.aspx</link><pubDate>Thu, 09 Oct 2008 11:23:13 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:105403</guid><dc:creator>jpsscott</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/105403.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=28&amp;PostID=105403</wfw:commentRss><description>&lt;p&gt;OK, thanks.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I&amp;#39;m putting ApplyTemplate in my constructor and I&amp;#39;ll see how that goes.&amp;nbsp; Is there a better spot to put it?&lt;/p&gt;
&lt;p&gt;The other thing I&amp;#39;m surprised about is I haven&amp;#39;t seen this mentioned on any other examples...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Regardless, thanks for the help and the additional info!&lt;/p&gt;
&lt;p&gt;James&lt;/p&gt;</description></item><item><title>Re: Event model and initialization with custom controls</title><link>http://forums.silverlight.net/forums/thread/105254.aspx</link><pubDate>Thu, 09 Oct 2008 07:34:54 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:105254</guid><dc:creator>Yi-Lun Luo - MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/105254.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=28&amp;PostID=105254</wfw:commentRss><description>&lt;p&gt;Unfortunately this is a limitation in Silverlight 2. Once we tried to fix the lifecycle problem but ran into a lot of browser related issues... Maybe the behavior will change in a future version, but I can&amp;#39;t assure you anything at this time... A workaround for template is to call ApplyTemplate to force the template to be applied. But if you have problems related to layout, there&amp;#39;s no good workarounds...&lt;/p&gt;</description></item><item><title>Event model and initialization with custom controls</title><link>http://forums.silverlight.net/forums/thread/104358.aspx</link><pubDate>Tue, 07 Oct 2008 19:31:15 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:104358</guid><dc:creator>jpsscott</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/104358.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=28&amp;PostID=104358</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I&amp;#39;ve worked on a few custom controls now and noticed a fairly annoying trend:&lt;/p&gt;
&lt;p&gt;Lets say I have a control that renders its contents when I call a Load function.&lt;/p&gt;
&lt;p&gt;When I call the controls Load function from the Load event of a user control the custom control is used in I will usually run into problems because it seems that OnApplyTemplate hasn&amp;#39;t been called yet in the chain of events.&lt;/p&gt;
&lt;p&gt;If a user control is loaded, why can&amp;#39;t I access the functionality of my custom control?&amp;nbsp; Am I not wiring something up right in the custom control?&lt;/p&gt;
&lt;p&gt;Basically I have some markup in generic.xaml, set the DefaultStyleKey and then in OnApplyTemplate I set a few member variables to controls I use within the custom control.&amp;nbsp; But OnApplyTemplate doesn&amp;#39;t seem to be called until after my user control containing the control is loaded.&lt;/p&gt;
&lt;p&gt;So now I&amp;#39;ve got code littered throughout my custom controls saying: if (someVar != null) {AdjustUI();}&lt;/p&gt;
&lt;p&gt;And then I&amp;#39;ve got code in LayoutUpdated etc to do the same thing.&lt;/p&gt;
&lt;p&gt;There has got to be a better way to do this.&lt;/p&gt;
&lt;p&gt;Comments anyone?&lt;/p&gt;
&lt;p&gt;James&lt;/p&gt;</description></item></channel></rss>