• Home
  • About
  • Archives
Subscribe: Posts | Comments | E-mail
  • .Net
  • Silverlight

Silverlight Muffins

Author Archive


Posted on August 21, 2009 - by Adam Elmore

Forward Time Travel & MSDN Roadshow Events

I had a good laugh when I saw that my last post was the night before the official Silverlight 3 release. I started this blog with good intentions, but the last month has been a whirlwind. I must have been one of the few people writing LOB Silverlight applications for a living that hadn’t touched the Silverlight 3 features until the official release. Since release, I have been frantically catching up while still maintaining the level of productivity needed to hit deadlines. Look for future posts outlining my experiences with Silverlight 3.

I spent the last week on a sort of vacation. I attended a couple of MSDN Roadshow events in the Northeast (”Mid-Atlantic Roadshow” and the “Suburban Roadshow”) and met with a client in New York. I had not had the chance to attend any MSDN events in the past, so I wanted to see what they were all about and maybe meet some fellow developers in the process. The experience wasn’t what I expected, to say the least. I’m not convinced that the target audience includes developers who are actually using the technologies being covered. I wasn’t necessarily expecting any earth shattering content, but I did expect that the presenters would have actual experience using the technologies they were discussing. In New York, the Microsoft Evangelist presenting on Dependency Injection admitted to hearing of the concept only days before the event. Seriously? You’re going to present on a topic that you barely have a definition for? I was actually answering questions for uninformed attendees when the presenter failed to do so.

I’m looking forward to PDC 09.


Posted on July 9, 2009 - by Adam Elmore

Silverlight 3 Bits

If you haven’t heard, Microsoft has some of the Silverlight 3 bits up on the web. Tommorrow we’ll see an official release. . . get excited!

Here are the downloads:

Expression Blend 3 with Sketchflow

Silverlight 3 Software Development Kit (SDK)

Silverlight 3 Tools for Visual Studio 2008 SP 1


Posted on July 7, 2009 - by Adam Elmore

Silverlight – My Favorite “Web Design” Technology

I was in Barnes & Noble over the weekend, browsing through the technology sections (picked up “Microsoft .NET: Architecting Applications for the Enterprise” by Dino Esposito) when I realized I wasn’t seeing any Silverlight books. I looked through various “programming” categories without any luck. I had decided that this particular small-town BN (Springfield, MO) might have a relatively narrow selection, but I was still shocked to think that they wouldn’t have a single book on the topic. Just as I was primed to ask an employee for assistance, I stumbled into the “Web Design” section of the store where I found a saddening surprise: Silverlight books. In droves. I suppose I should update my job title. . .


Posted on July 2, 2009 - by Adam Elmore

Custom Control Resources

This morning I ran into an interesting bug while working on a custom TabControl created by another member of my team. This TabControl (appropriately named, “TabControl2″) adds a button in the TabPanel for adding new TabItems (among other things). For various reasons, this Button is created dynamically in the class definition and added to the current TabPanel. No problems here until it was time to style the Button in a way that would fit the application. After taking a look at TabControl2.cs, I quickly saw the first mistake:

TabControl2.cs

OnApplyTemplate

generic.xaml

2-6-2009_6

AddTabButtonStyle is a DependencyProperty used to update the Style of the dynamically created Button. As you can see, an attempt is made to set the value of this property to the “Local_NewTabButtonStyle” Style. Knowing that the Style defined in generic.xaml is not located within this control’s Resources, I saw a few possible solutions. The obvious solution was to store the Style somewhere within the TabControl2 ControlTemplate. This would give us easy access to the resource in the TabControl2 OnApplyTemplate() method. However, this particular control didn’t have a ControlTemplate defined as it derived directly from TabControl and did not make any changes that warranted a new template (outside of this particular Button). At this point, the smart move would have been to create a default ControlTemplate targeting the TabControl2 control and throw my Button Style directly into the template. Another solution involved creating the Style in C# (no thanks). Turns out, I’m lazy and went with solution number three: move the Local_NewTabButtonStyle resource to App.xaml (that’s right, the application level resources; not so “Local” anymore..), and pull it from Application.Current.Resources.

App.xaml

2-6-2009_3

TabControl2.cs

2-6-2009_4

Aside from the fact that this is very poor design when it comes to creating a custom control, using this “solution” also introduced a very strange bug. I initially ran the application and saw that the style was being applied correctly (after all, the style does reside within the application’s ResourceDictionary). Not feeling the least bit guilty, I moved on to more important tasks (don’t judge me :P ). An hour later, our team designer hopped on his Mac to take a look at the changes only to find that the application wouldn’t load. I picked up my wife’s MacBook and confirmed the problem: after finishing the Silverlight loading animation, the application loaded a blank white screen. In addition, the browser’s error console was void of any Silverlight exceptions (this problem was occurring in both Firefox and Safari). Strange.

After much toil, I came to the realization that my Application level resource was the culprit. After creating a ControlTemplate for TabControl2 and storing the Style in the root Grid’s resources, I quickly remedied the problem.

generic.xaml

2-6-2009_2

TabControl2.cs

2-6-2009_5

I’d love to hear an explanation for this issue. One thing is for sure – it never rarely pays to take the quick route.



  • Recent Posts

    • Forward Time Travel & MSDN Roadshow Events
    • Silverlight 3 Bits
    • Silverlight – My Favorite “Web Design” Technology
    • Custom Control Resources
  • Archives

    • August 2009
    • July 2009
  • Blogroll

    • Dino Esposito
    • Jesse Liberty
    • John Papa
    • Laurence Moroney
    • Mike Snow
    • Scott Guthrie
    • Tim Heuer
    • Tim Sneath
© 2008 Silverlight Muffins - Sharing with the world, one muffin at a time.
jeux de casino by jeux de casino