Learn



  • 0 comments  /  aggregated from  house of mirrors  on  Sep 15, 2006 (more than a year ago)   /   original article
    Styled Tooltips



    It took me a while to realize it, but in WPF you can even style the tooltips! It's actually pretty cool, I just wonder why the default style is the same old boring yellow rectangle.

    I decided it'd be super cool to have bubble quotes instead. Now if only I could convince the Vista folks on this as well :)

    My 10 minute hacked version:




  • 0 comments  /  aggregated from  Tales from the Smart Client  on  Sep 06, 2006 (more than a year ago)   /   original article

    During the past year, we’ve found and fixed a lot of perf issues in Expression and WPF.  I’d like to relate a few of them, not so much because you’ll have the exact same problems, but that the pattern of finding and resolving the bugs may be helpful experiences.  To start:

     

    Expression uses a tree data structure to keep track of the XAML source code.  Each node in the tree has a property called Children that returns a List of all its child nodes. For leaf nodes this collection was always empty, but even so a new collection object was always allocated. In some scenarios, this resulted in megabytes of allocations.  To fix this, we implemented a singleton EmptyList class.  Leaf nodes always return the same instance of this collection, removing all the allocation costs.

  • 0 comments  /  aggregated from  Tales from the Smart Client  on  Mar 22, 2006 (more than a year ago)   /   original article
    I was going to post something about the various levels you can use in WPF for graphics, but Pablo Fernicola beat me to it:  http://www.fernicola.org/loquitor/index.php?/archives/17-WPF-Pick-Your-API-Abstraction.html
  • 0 comments  /  aggregated from  Tales from the Smart Client  on  Mar 08, 2006 (more than a year ago)   /   original article

    CollectionView is a very interesting construct.  After including it in my ViewModel I meant to quickly blog about the usage...but when I started thinking about it and reading a bit more about it, it becomes even more interesting.  Lots of good blogging.  However, while I think about it, let me quickly make my original point.

    The Model has a simple List.  CollectionView wraps a Collection and adds concepts like selection, sorting and filtering to it and supports the INotify... goodness that data binding wants in order to do a really good job.

  • 0 comments  /  aggregated from  house of mirrors  on  Feb 10, 2006 (more than a year ago)   /   original article
    Rob Relyea from the Avalon team has a cool intro to 'attached properties', but sadly he doesn't go into the real fun you can have with attached properties. Basically they let you store data on arbitrary DependencyObjects, but the key is that they provide a callback whenever that data changes. Suddenly, this sealed to the hilt behemoth of an API can be extended.

    My current side project is to create my own set of extensible events and actions, but since EventTrigger and TriggerAction are sealed and give us non-Avalon folks no love, enter attached properties:


    <Rectangle Name='RedRect' Width='100' Height='66.6' Fill='Red'>
    <evt:Triggers.Triggers>
    <evt:PropertyTrigger Trigger='{Binding ElementName=RedRect, Path=IsMouseOver}' Value='True'>
    <evt:SetterAction Property='IsActive' Value='True' Target='{Binding}'/>
    <evt:MethodAction Method='Play' Target='{Binding ElementName=VideoFrame}'/>
    evt:PropertyTrigger>
    evt:Triggers.Triggers>
    Rectangle>


    So Triggers.Triggers is an attached property of a collection of Trigger objects.