This is a mirror of official site: http://jasper-net.blogspot.com/

Catel - Part 7 of n: What’s new in Catel 2.x

| Wednesday, August 17, 2011
Table of Contents

  1. Introduction
  2. General
  • 2.2. IPleaseWaitService implementation for Silverlight
  • 2.3. Single namespace for all controls
  • 2.4. Auditing
  • IoC containers / ServiceLocator
  • 3.3. External containers
  • 3.4. Synchronization between containers
  • 3.5. Supported external containers
  • MVVM behaviors
  • WP7 Mango support
  • What’s next?

  • 1. Introduction

    Welcome to part 7 of the articles series about Catel. If you haven’t read the previous article(s) of Catel yet, it is recommended that you do. They are numbered so finding them shouldn’t be too hard.

    This article is all about the new Catel 2.x releases. Catel 2.0 was released on August 4th, 2011 and contains tons of new features and improvements. This article will handle the most important changes and new features.

    There are some features that are important enough to name in this article, but not important enough for a separate chapter. Therefore, some of the changes are described in the general part.
    2. General

    This chapter describes features that are important enough to be mentioned, but do not required a separate chapter because the explanation is fairly simple.
    2.1. Behaviors

    Catel now offers several new behaviors out of the box. The developers of Catel are normally spoiled with the luxury of developing applications using WPF, but sometimes they need to write software using Silverlight. One of the downsides of writing applications in Silverlight is that a lot of functionality you are used to in WPF is not available. Two of these simple things are the missing DoubleClick event and the missing option to update a binding on property changed instead of lost focus.
    2.1.1. DoubleClickToCommand

    To easily enable developers to use these “luxuries” in Silverlight, two new behaviors are developed. The DoubleClickToCommand allows a developer to enable the DoubleClick event (which is not available) on any FrameworkElement that supports the LeftMouseButtonDown event. So, if a DoubleClick event must be added, this can simply be done using the behavior. Say there is an Image control representing a logo, and the user should be able to double-click it to edit the logo. The following code is sufficient to create this behavior:

    <Image Source="/Catel.Demo;component/resources/images/catel.png">
        <i:Interaction.Triggers>
            <catel:DoubleClickToCommand Command="{Binding EditLogo}" />
        </i:Interaction.Triggers>
    </Image>

    2.1.2. UpdateBindingOnTextChanged

    One question we get asked on a very regular basis is how to update a binding when the user types something into a textbox. By default, the binding only updates when the textbox loses the focus. Sometimes, this behavior is not enough because the developer wants to give the user feedback immediately when typing in a textbox. Or, another usage is a textbox with a filter where the filter should apply immediately after typing into a textbox.

    One option to solve this problem is to subscribe to the TextChanged event in the code-behind and update the binding explicitly. A better option is to use the UpdateBindingOnTextChanged behavior that ships with Catel.

    <TextBox Text="{Binding SearchParameter, Mode=TwoWay}">
        <i:Interaction.Behaviors>
            <catel:UpdateBindingOnTextChanged />
        </i:Interaction.Behaviors>
    </TextBox>


    Read more: Codeproject
    QR: Catel_Part7.aspx

    Posted via email from Jasper-net

    0 comments: