Archives / 2008 / November
  • Customizing ASP.NET Dynamic Data

    From Wikipedia: “ASP.NET Dynamic Data is a web application scaffolding framework from Microsoft, shipped as an extension to ASP.NET, that can be used to build data driven web applications.

    So if you use VS2008 and .NET 3.5 SP1 you can take advantage of ASP.NET Dynamic Data to quickly create a full administration website (UI and CRUD) over a model (LINQ To SQL or better Entity Framework) on top of some db tables, and all this in about 3 minutes!

    Furthermore the system is very flexible and you can customize the look and feel of the generated web pages through a set of pages and user controls available on the DynamicData folder.

    But the default “3 minutes” experience create a web app that exposes CRUD operations on every tables/every columns…

    Default screen while editing the products table:

    What you may want to customize:

    • Prevent some tables to be “scaffolded”
    • Change table display name
    • Format columns data
    • Hide some columns (like Ids)

    This is the part where you’ll need to write a bit of code. In App_Code folder create new file that will hold several partial class to provides metadata information. You need to add 2 class for each entities in your model, one partial class with the name of the entity, and one sub-class to set metadata. The second one is “attached” to your entity class with the MetadataType attribute.

    C# snippet for Products entity:

    public partial class Products
        [TableName("Company products")]
        public class Products_Metadata
            public object ProductID { get; set; }
            public object ProductName { get; set; }
            [DisplayName("Price"),DisplayFormat(DataFormatString = "{0:c}")]
            public object UnitPrice { get; set; }
            public object UnitsInStock { get; set; }
            public object ReorderLevel { get; set; }
            public object Discontinued { get; set; }
            public object QuantityPerUnit { get; set; }
            public object UnitsOnOrder { get; set; }
            public object Suppliers { get; set; }
            public object Order_Details { get; set; }

    To remove a table, use the ScaffoldTable(false) attribute.

    Products table will now appear as “Company products” (TableName attribute).
    I keep only 4 columns and rename them (ScaffoldColumn and DisplayName attributes).
    Price column is formatted as currency (DisplayFormat attribute).

    See the result:


    Technorati Tags:
  • [Cool Tool] Silverlight Defaul Style Browser

    SilverlightDefaultStyleBrowser is a free WPF tool by David Anson that allows you to inspect the styles and templates of the Silverlight controls.

    Follow this link to learn more and download the app:


    Technorati Tags:
  • Silverlight resources for designers

    When I am training Silverlight I am often asked by designers how to find resources on Silverlight/XAML/Expression, so here is a post for them:

    First you can find lots of Expression Studio videos training in the new Microsoft videos portal: provides videos training on Expression Blend and Expression Design:


    Expression Design tutorials on the Microsoft Expression Team blog:

    Here are some XAML exporters to help you do Silverlight with your assets from Adobe tools:

    The fantastic NibblesTutorials website (Expression Blend):

    This blog post collect free Silverlight controls and tools available on the net:

    And finally this interesting blog:


    Also as a designer you NEED to know about the Expression Professional Subscription, for a very good price ($999 USD) you get:

    • Expression Studio 2
    • Visual Studio 2008 Standard
    • Windows Vista Business
    • Windows XP SP2
    • Office Standard
    • Office Visio Professional
    • Pre-configured virtualized server environments (VPC)
    • Virtual PC (to use the VPC)
    • Parallels Desktop for Mac (a 3rd party application to run Windows OS on Apple hardware concurrent with OSX)

    So typically if you are a MAC designer with no Microsoft platform tools you get everything you need to get started and create awesome user experience applications with Silverlight!


  • Silverlight Tour Training FAQ

    Formation Silverlight

    I’ve just finished teaching my first Silverlight Tour training in Montreal, people were very excited about Silverlight 2 and I got lots of interesting question I thought I could share (with my answers!):

    * Can you export XAML from Adobe software's?

    There are some plug-ins available to export XAML from Adobe tools:

    These tools are not always perfect and some only export XAML for WPF, I think the best way is to import your graphics in Expression Design then export XAML.

    * How do you localize a Silverlight app ?

    There is no “Generate Local Resource” support to localize XAML UI.
    So this is not as easy as ASP.NET but it is possible to use multiple xap files for your manually generated resx as explained in this link:

    * Animation: can we set Duration property in milliseconds ?

    XAML syntax for Duration is: Duration=”00:02:50” (0 hour, 2 minutes, 50 seconds).
    To use milliseconds you can simply set: Duration=”00:00:00.5” (50 milliseconds)
    or by code: obj.Duration = TimeSpan.FromMilliseconds(50);

    * Animation: Can we use Motion Path ?

    No, motion path can be used in WPF but not in Silverlight.

    * Can you use Silverlight in a Windows Forms app ?

    You can use a WebBrowser control and set its Url property to your web page hosting Silverlight app.

    * What about printing a Silverlight app ?

    Currently there is no particular print support in Silverlight. It will print “as is” in IE but not in Firefox (blank area).

    * Do multiple Silverlight app can share Isolated Storage settings?

    Yes, xap from the same domain can access datas set via IsolatedStorageSettings.SiteSettings[…].


    Also some students found a bug in Visual Studio 2008: You don’t have XAML IntelliSense in a DataTemplate:

    <ListBox x:Name="myListBox"
           no IntelliSense here...


    Check our website for the next Silverlight training in french!


  • Silverlight Extensions

    Silverlight Extensions is a nice project which group useful Silverlight controls and best practices:

    Controls Helpers Players
    • Treeview
    • Captcha
    • Virtualized stack
    • panel
    • Dockpanel
    • Flow layout
    • Viewbox
    • GoogleMap
    • Virtual earth
    • Change tracker
    • Binding comparer
    • Bootstrap
    • HTML Editor
    • CommandService
    • Deepzoom helpers
    • Mouse wheel Listener
    • Various comparers
    • Google analytics
    • Browser history
    • Deepzoom
    • Video
    • Photo

    You can download all this for free at CodePlex:

    Same question as for Silverlight Contrib: will the controls merge with Silverlight Toolkit ?

    Have a look at the live Showcase:

    Silverlight Extensions 


    Technorati Tags:
  • Developing for IE8 (Accelerators and Web Slices)

    IE8 MSDN

    Lately I wrote an article for MSDN to introduce Accelerators and Web Slices in IE8 and show how to build them.

    Here is an overview:

    Web Slices bring the user’s favorite data (sports scores, weather reports, stock quotes, etc.) directly into the Favorites Bar. So Web Slices are like snippets of a page that a user can subscribe to. Changes and updates are retrieved and users are notified visually of the updated information status. Like any page, a “slice” can display text, links, pictures and even RIA elements (Silverlight!)… think about RSS on steroids.


    Creating a Web Slice
    Web Slices can be hosted in any web page. In fact you just have to define which part of you page can be “sliced” for the user. That means that you can turn any part of an existing web page into a Web Slice!

    Web Slices use a combination of the hAtom microformat and the Web Slice format to describe a subscribable portion of a webpage.

    hAtom is a microformat for content that can be syndicated, primarily but not exclusively weblog postings. hAtom is based on a subset of the Atom ( syndication format. hAtom will be one of several microformats open standards. More information

    So to enable a Web Slice on your website, you just annotate your page with specific class names for the title, description, and content.

    Here is the basic skeleton of a Web Slice:

    <div class="hslice" id="sliceId"> 
      <p class="entry-title">My Slice Title</p> 
      <div class="entry-content">

    hslice defines the Web Slice section and must have an Id.
    entry-title is the title which appears in the favorites bar.
    entry-content is the body of your Web Slice (you can use any HTML content here).


    Accelerators in IE8 are contextual services to quickly access information from another website in your current browser page. The goal here is to be more efficient than the old "copy-navigate-paste" model. As soon as users select some text in a page, a blue icon appears to list available accelerators. Clicking on an accelerator opens a new tab with desired results. Optionally accelerators can have a preview window.

    For example, suppose you’re on a page with a street address. You can highlight the address and choose an Accelerator such as Map with Live Maps. The accelerator will then display the map in a pop-up or open another tab, depending on how the Accelerator has been written for that site.


    Creating an Accelerator
    Building an Accelerator is really just about creating an XML file which describes your service. Results can be fetched from any service that can be queried over HTTP (GET or POST requests). This includes popular search engines like Live Search or Google but also sites such as Wikipedia, Facebook, eBay, Yahoo, Twitter or Digg.


    Here is a sample code using the Live Search query URL passing the user’s selected text as “q” parameter in querystring to get related images:

    <?xml version="1.0" encoding="utf-8"?>
    <os:openServiceDescription xmlns:os="
         <os:name>Search Images with Live Search</os:name>:
         <os:description>Find related images with Live Search</os:description>
      <os:activity category="Search">
         <os:activityAction context="selection">
           <os:execute action="" method="get">
             <os:parameter name="q" value="{selection}" type="text"/>

    The heart of your Accelerator is defined by these XML elements. The XML document is based on the OpenService specification:

    os:activityAction specifies the interaction with the service provider based on the target of the Accelerator. The optional context attribute specifies the target: document, selection (default), or link.

    os:execute specifies the action (page to call) when the user invokes the Accelerator and the method (GET or POST).

    os:parameter specifies the parameters for the page. Note the use of a special variable {selection} which represents the user’s highlighted text. Alternatively, the variable {link} can be used to get the href of a selected link.


    Read the full article here:

    Also check my Accelerators available on the IE gallery:

  • Search Images with Live Search
  • Search with Google Canada
  • Find Songs on Zune Social *
  • Find Albums on Zune Social *
  • Find Artists on Zune Social *

  • * For some reasons Microsoft has removed my Zune Accelerators. Sorry about that.

    Technorati Tags: ,,
  • Silverlight 3: Line of Business app made easy!

    Interested in building Line of Business app with Silverlight ?

    Check out this presentation from Jamie Cool at PDC2008:

    You may want to go straight to 30min on the talk to get the good stuff…
    Jamie shows what’s coming in Silverlight 3: a new framework to help you build business focused applications:

    • Data access with client side ObjectDataSource!
    • Silverlight Business Logic Class (used inside Silverlight without adding a service reference!!)
    • Validator controls, validation rules enforced by server–side business class
    • Navigation workflow, browser history integration
    • Login control, roles

    This is coming… and this is huge! This reminds me of what was ASP.NET 2.0 compared to ASP.NET 1.1!

  • You shape it – a new Microsoft tech portal

    You shape it

    Microsoft has a new web site to start the excitement on his new dev technologies: IE8, WPF, Silverlight and Windows Mobile. It is called {You shape} it and focus on Design, Development and IT Management in a nice claymotion Silverlight UI.

    MSDN is part of this portal ( and I am a contributor as I wrote the article on IE8 development “IE8: Improve the Browsing Experience” that shows how to build Accelerators and Web Slice, check it out!

  • Silverlight FAQ from TechDays Canada 2008

    My Silverlight sessions at TechDays Montreal were a great success and generated so many questions like “Is ASP.NET dead ?”, “What about Silverlight vs WPF XBAP ?” or “Would you recommend Silverlight for line of business application ?” that we decided to create a FAQ and it was published on the Canadian Developer Connection blog thanks to Qixing:


    Technorati Tags:
  • Silverlight Contrib

    Silverlight Contrib is a collection of Silverlight Controls and API enhancements built for and by the Silverlight developer community and hosted on CodePlex.

    Current version has the following features:


    • Color Picker
    • Gauge Control
    • Star Selector
    • Enhanced Metafile (EMF)
    • Cool Menu


    • Zip Compression
    • Byte Utilities
    • String Utilities
    • Simple Text Parser
    • Animation Tweening
    • Wheel Mouse Listener
    • Clipboard Helper (Internet Explorer Only)
    • Data Context Extension Method Wrapper

    I am not sure about the controls has we now have the Silverlight Toolkit (futur merge?), but the APIs are great!

    CodePlex project:

    You can see live demos there:

  • ASP.NET Dynamic Data Web projects templates

    Since Visual Studio 2008 SP1 you may have noticed 2 projects template for dynamic data:

    Dynamic Data Web Site - Dynamic Data Entities Web Site

    So what is the difference ?

    • Dynamic Data Web Site / Dynamic Data Web Application:
      Uses a LINQ to SQL model and LinqDataSource controls.
    • Dynamic Data Entities Web Site / Dynamic Data Entities Web Application:
      Uses a ADO.NET Entity Data Model and EntityDataSource controls.

    Since LINQ to SQL is dead I would not recommend using Dynamic Data Web templates. LINQ to Entities is now the recommended data access solution and will remain in .NET 4.0, so for your RAD Scaffolding needs you should use Dynamic Data Entities Web Site/Web Application!

  • My Silverlight presentations at TechDays 2008 Canada

    Here is the Silverlight 2 project I build for my “Mastering your Silverlight Samurai Skills” 2 parts talk I did at TechDays Canada 2008.

    Powerpoint material will come later.

    Usefull links

    Silverlight controls:

    Deep Zoom demos:

    My company RunAtServer Consulting is doing Silverlight development, we already have some clients and realizations, don’t hesitate to contact us!

    Silverlight Montreal



    We also have a 3 days Silverlight 2 training in french!
    >> More information (fr)

    Technorati Tags:
  • Silverlight sessions at DevTeach Montreal 2008

    [via Guy Barrette]
    Looks like there will be plenty of Silverlight content at DevTeach Montreal this year:


    Building Silverlight Controls
    David J Kelley - SLV467
    Designed primarily for Developers. This technical presentation walks through a number of senerios for building Silverlight Controls including user controls and custom panels. The usage of properties, dependency properties, events, reusability, and encapsulated control architecture is reviewed in detail. In the presentation we will build a custom chart control based on a user control and built custom panels and review dispatch timer and multi threading in the context of controls.

    Comparing Silverlight to ASP.NET
    D'Arcy Lussier - SLV301
    With Silverlight, web developers now have a new option for delivering browser-based applications. But does Silverlight negate HTML-based web development? Should we put aside traditional web development for this new paradigm? In this session we’ll compare Siilverlight and ASP.NET, not to prove one as better than the other but to show why you might consider one over the other for your next web application.

    Data Visualization with WPF and Silverlight 2
    Tim Huckaby - SLV202
    Building Data Visualization Applications with the Windows Presentation Foundation (WPF) & Silverlight 2.0
    This session will be heavily demo focused to accentuate how the power of the Windows Presentation Foundation (WPF) and Silverlight 2.0 can be used to visualize data. WPF is the next-generation presentation sub-system for Windows. It provides developers and designers with a unified programming model for building rich Windows smart client user experiences that incorporate UI, media, and documents. WPF uses vector based graphics rendering, which results in better graphics and presentation for an application. WPF also has other features such as layout, styling, and data binding, which, when you mix with interactivity, enables scenarios such as interactive data visualization. When you put all this together, you have a unified API for various presentation components, such as 2D and 3D documents and declarative programming through XAML, which is a powerful platform for data visualization that can be used to really “light-up” you enterprise applications.

    Designing Interfaces with Expression Blend
    Markus Egger - SLV333
    Silverlight and WPF (Windows Presentation Foundation) are powerful UI technologies, and XAML represents a fascinating new way of programming WPF and Silverlight. However, without tools, XAML gets tedious quickly, and a good designer is needed. Microsoft offers a whole set of such tools. This session focuses mostly on MS Expression Blend (used in combination with Visual Studio). This session provides an overview of the goals, features, and characteristics of this tool and shows how to create a small next-generation application using it. This session also shows developers how good looking interfaces can be created using a few simple and repeatable tricks.

    Hacking Silverlight 2
    David J Kelley - SLV469
    Hacking Silverlight 2.0 for designers and developers
    Designed for Designers and Developers. This engaging presentation gets the audience involved in bridging the gap between design teams and software development using Silverlight and the Silverlight toolablity story. The presentation is full of audience participation and skits that get audience members up out of their seats and excited about Silverlight. The basics of team work using Microsoft tools for design and development are used and the audience is shown some of the coolest Silverlight hacks that can make Silverlight applications really shine. With the “Coming out of the closet” skit the audience is shown sexy UI using Silverlight, learning about speed of development and why we care about Sexy engaging Web 2.0 experiences.

    Silverlight 2 Controls: Data on Board
    Dave Campbell - SLV355
    Learn how to populate your Silverlight controls with data, and how WebServices are your friend. This will be done using LINQ and WCF webservices, in addition to more traditional code-behind and asmx.

    Silverlight 2 Controls: Your Controls, Your Way
    Dave Campbell - SLV389
    Learn how to use the Parts and States model and VisualStateManager to your benefit in your environment. Starting with existing controls through modification using VS2008 and Blend to produce a Custom Control that is then consumed.

    Silverlight 2.0 Achitectural Best Practices
    David J Kelley - SLV421
    Designed Developers and Architects or people wanting to understand Silverlight archtecture. This presentation startings with a detailed technical review of Silverlight control, application architecture and design patterns. Design patterns as applied to Silverlight application development and general best practices are reviewed in detail. The presentation includes learning from the trenchs of building Silverlight apps on a large scale including horror stories and ‘Anti-Patterns’ or things ‘not to do’ are reviewed.

    Silverlight Development: Lessons from the Trenches
    D'Arcy Lussier - SLV349
    So what’s it like creating a line of business application using Silverlight? What are the differences in developing a Silverlight application compared to a Winform or ASP.NET based application? In this session I’ll share with you my experiences in creating a real-world Silverlight based application and what you should expect /look out for when developing with this exciting new technology.

    Silverlight 2: Business Oriented App. (In French)
    Laurent Duveau - SLV321
    You've already heard a bit about Silverlight? You have some knowledge of this technology which is now available?
    Come discover how to create a business oriented application: that means manipulate data and build a rich UI with Silverlight!
    During this session I'll use Visual Studio 2008 and Expression Blend to build an application that retrieves SQL server data through an Entity Framework model and exposes it to Silverlight client via a WCF service. I’ll use a grid to display the data and asynchronously update the model as users edit the grid. Finally I will show you how to place the data in local cache on the client to optimize network traffic.

    Turning on the Silverlight – A Silverlight Intro
    Markus Egger - SLV201
    Microsoft Silverlight is the latest generation of Microsoft UI technologies for web browser applications. It is based on (and a sub-set of) WPF (Windows Presentation Foundation). It enabled developers to create next-generation user interfaces in web browser applications that work not just on Windows systems, but other environments such as the Apple Mac or mobile devices. This is a radical departure from previous .NET development, which was limited to Windows systems. Silverlight applications enable developers to run .NET code on non-Windows Systems. This session also compares Silverlight to other technologies such as Flash. Attendees of this session will get a good feel for what it is like to develop real life applications in Silverlight.

    User Controls, Customization, and Styling
    Dave Campbell - SLV312
    Silverlight 2 Controls: User Controls, Customization, and Styling
    Get your Silverlight application Stylin’ with out-of-the box techniques for making your UI to not only look like it was all written by the same company, but also matching your corporate identity. This will be showing VS2008-only concepts, so no design knowledge or interest is necessary.


    As you can see I will be presenting a session and it should be interesting as I will build a full Silverlight application live with very few powerpoint... can’t wait to be there!
    Are you registered ? Hurry up, it is coming in Montreal on December 2-4!

  • I’M A PC at Apple Store…

    What a couple of MVPs do when they get a free “I’M A PC” toque ?

    They run to the first Apple store and ask an employee to take a picture!

    I'M A PC at Apple Store

  • My IE8 Zune Social Accelerators and Search Provider

     IE8 Zune

    I made 3 Accelerators to interact with Zune Social right into IE8:

    * For some reasons Microsoft has removed my Zune Accelerators. Sorry about that.

    Also a Search Provider to search for Songs, Artists and Albums on Zune Social:



    Check out my other IE8 Accelerators:


    And Search Provider:

    Technorati Tags: ,,
  • Zune feedback


    As you may have heard Zune v3 is out, I spent a long time playing with it to provide my feedback one¦more time.

    First thought: Zune software is still a piece of sh*t!

    But I have to say this is no more the worst software ever written by Microsoft, it is a bit better now, but still full of crappy features and the UI s*x badly. First, I always wonder myself: “why the hell did they create a NEW media player ???”.
    Windows Media Player v11 - Zune v3 - Hello?
    Marketplace?? Why not simply add a new “Social” tab on WMP ??

    So that is the point, I start this feedback exactly like my previous one: “both Zune software and firmware can do a lot better”.

    Having said that I will start with what I like on this new version:

    • The “Add to now playing list” feature on device. Best.Thing.Ever! they finally get rid of the “Quick list” stupid feature (it was soooo useless!)
    • Games are officially supported!
    • Time displayed on device main screen
    • Zune is now able to go back to current song after viewing some pictures.
    • Find Zune buddy by Live ID: Now, on your "my social" page you can see if any of your Windows Live contacts have a Zune Card and add them as friend.
    • Picks are great and allow you to get personalized recommendations.
    • I can’t talk about Channels as I don’t have a Zune Pass but this seems very nice.

    Now here is my list of suggestions :

    * Device:

    • Add some auto playlists please
      • Last sync (a bit like the “date added” view in software). When I have a lot of music in my Zune it become hard to find the last synced music.
      • Favorites songs, the one tagged as “heart”.
    • Snooze mode. Not a big deal but this would be a nice addition.
    • Screensaver: why not? my Zune at home is always docked and can’t stop itself, so it would be nice to have a screensaver coming – or to be able to enter sleep mode while docked.

    * Software:

    • Add a Folders view (like Windows Media Player) tags are nice but a great part of my collection is not tagged so I have difficulties to browse my music. This is also a big problem with compilations which generate me thousands of artists entries with only one album/song. I would love to have a setting “Do not display artists with less than X songs in artists view”. See also next bullet.
    • Add a live search box (like in WMP library).
    • I would like to get some stats of my library (number of albums, songs, artists, most played song, album, artist, ….)
    • Now playing screen is interesting (and really beautiful with artists shots and stats) but… I would need a party mode, where I can see the current playlist, sort, move and add new music. It would be like a “Now playing” + collection view.

    Also it seems to me there is a bug: while playing just one song (not an album), then browse to another song and "add to now playing list": it turns out that the song is queue after the whole album of the current playing song. I would need to add songs one by one to the current playing list, what do you think ?


    Don’t get me wrong my goal is not to flame Zune but to bring ideas and feedback to make it better. I like my Zune, but to me the Zune Software is a total mistake.

    If a Microsoft guy or better someone from the Zune Team read this, I would love to be a beta tester and bring my feedback, do you have a beta program ?

    As an MVP + Windows Live Butterfly let me say I am strong on feedback.


    Technorati Tags: