Vincent Leung's .NET Tech Clips

The latest tech clips from the .NET community

Multi-touch in Silverlight 3

Jesse Bishop is a program manager on the Microsoft Silverlight team talks about implement Multi-touch Gesture Recognition in Silverlight 3

“Silverlight 3 provides all the info you need to receive and interpret multi-touch input on Windows 7, but it takes some work to translate these events into standard gestures – like “pinching” to zoom in or out (a list of other common gestures, and some good background info, can be found on the Engineering Windows 7 blog).

Tim Heuer gave a great introduction to the basics of Silverlight 3 multi-touch, covering hardware/software requirements and how to listen to the application-wide Touch.FrameReported event to get touch information.  Building on these basics, I’d like to give a short example of how you can add support for some common gestures – such as Translation, Rotation, and Scaling – to your touch-aware Silverlight 3 application on a per-element basis.

At a high level, the steps to accomplish this are:

  1. Receive touch events at an app level.
  2. Route touch events to the target element(s) being manipulated.
  3. Interpret touch events on a target element as gestures.
  4. Hook up gestures to manipulate the element.

To make things a bit simpler and more reusable, I’d like to create a static class to accomplish #1 and #2 – I’ll call it TouchProcessor.

For #3 and #4, I would also like to be able to reuse this logic – so I’ll create a GestureController class to receive events on behalf of an element, and define an ITouchElement interface that it can use to manipulate elements.”

Delving into more detail on each of these –> jebishop.blog

November 11, 2009 Posted by Vincent Leung | Silverlight | | No Comments Yet

Bing Maps Silverlight Control SDKs released

image

The Bing Maps Silverlight Control combines the power of Silverlight and Bing Maps to provide an enhanced mapping experience. Developers can use the Bing Maps Silverlight Control to incorporate the latest location and local search features into their applications.

  • Getting Started Using the Silverlight Map Control
  • Accessing the Control Using a Bing Maps Key
  • Using the Interactive SDK
  • Developing with the Silverlight Map Control
  • Programming Reference for the Silverlight Map Control
  • Developer Resources and Support
  • Download the SDK here: Bing Maps Silverlight Control SDK and check out the interactive SDK.

    November 11, 2009 Posted by Vincent Leung | Silverlight | | No Comments Yet

    Skinning and Styling Silverlight Controls

     

    To change a look of Silverlight controls the way that you want it to, you can style it by modifying default template of the control. Silverlight controls have XAML based templates that can easily be changed and saved as new template. You can change the look for entire control without writing any line of code in C#. It can be done completely in XAML. However if you want to do minor modifications to the look of control such as change background color or default font you can do it directly in XAML without need to change default template of the control.

    For example we can simple change foreground color of text for TabItem control by setting foreground property directly in XAML of that control without need for changing template for that control :

    <my:TabItem Header="Buy or earn chips" Foreground="#FF6A1D38">    <Grid>    </Grid></my:TabItem>

    This article will show you how to build custom template for Silverlight 3 TabControl.

    Easiest way to modify default template for control is to that in Expression Blend. In Expression Blend menus called Objects and Timeline locate your control for witch you want to modify template, right click on it and choose Edit Template –> Edit a Copy . After that Expression Blend will ask you where to save copy of template in UserControl.Resources or in Application.Resources. For this example I will save all templates in Application.Resources in App.xaml file.

    EditTemplate

    After that you will get a copy of template for TabControl. In this case we have few objects in the template: TemplateTop, TemplateBottom, TemplateLeft, TemplateRight. The objects in the template that are referenced by the code are called parts. We can view the parts in the Parts panel when you are editing a control template in Expression Blend.

    TemplatePart

    Via Skinning and Styling Silverlight Controls

    November 10, 2009 Posted by Vincent Leung | Expression Blend, Silverlight | | 1 Comment

    Microsoft SDK for Facebook Platform – Official Support by Microsoft & Facebook

    Official support from Facebook & Microsoft: the Microsoft SDK for Facebook Platform.

    Overview

    To get started we recommend you download the SDK and refer to the "How to" guides and the Facebook Developer Wiki to get familiar with these new resources.

    1. Download the SDK.
    2. Refer to the detailed instructions on the Facebook Developer Wiki. Here are some important links to use as a starting point.

    Facebook SDK Version 3.0 Notes

    ASP.NET Development
    ToolKit Content Folder
    Facebook Platform
    Other Platforms

     

    November 10, 2009 Posted by Vincent Leung | Facebook | | No Comments Yet

    What is the Windows Azure Platform?

     

    There are various types of Cloud offerings that exist in the internet today. These offerings are Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS). Figure 1 below shows each of these offerings and what they host. Understanding what each offering hosts, the relationship of the cloud vendor to the software owner, and the relationship of the cloud vendor to the end user is a good way to understand the differences between each of these offerings.

    Figure 1 – Types of Cloud Offerings and what they host

    image

    Figure 2 – IaaS Vendors

    image

    Figure 3 – PaaS Vendors

    image

    Figure 4 – SaaS Vendors

    What is a Software Platform?

    When the word “Platform” is used in the context of software what is really meant is what is shown in Figure 5. The best way to visualize a software platform is to think of it as being composed of two parts. The first part is a runtime environment for your application or your custom code. The second part is a collection of tools that can be purchased (as opposed to built) that solve common problems.

    Figure 5 – A Software Platform

    Via What is the Windows Azure Platform?

    November 10, 2009 Posted by Vincent Leung | Architecture, Azure | | No Comments Yet

    The Top 10 Most Common API Pitfalls

     

    A robust application programming interface (API) has become essential for today’s successful SaaS independent software vendors (ISVs). As a SaaS vendor, you should expect that a majority of your customers are going to require interoperability with other SaaS applications, web services, and legacy systems. As demonstrated by internet pioneers Google, Amazon, and Facebook, an open application strategy facilitates deeper customer usage and enables new revenue streams. Integration is critical for SaaS vendors, and developing a reliable API strategy is the first step toward achieving that goal.

    After reviewing hundreds of actual SaaS APIs, many up to par and others distinctly subpar, it is clear that there are a number of common mistakes made when developing an API. Fortunately, each of them can be easily remedied by following best practices.

    1. Exposing operations instead of objects

    2. Assuming a WSDL contains everything necessary to describe your API

    3. Developing a single version of your API which changes with each release of your SaaS application

    4. Never batching or throttling the results of query calls against your API

    5. Maintaining separate schemas for adding, updating, or removing your Customer object

    … + more … The Top 10 Most Common API Pitfalls

    November 10, 2009 Posted by Vincent Leung | Architecture | | No Comments Yet

    A better way to do Silverlight 3 Sorting & Paging using DomainDataSource & DataPager

     

    Silverlight 3 includes PagedCollectionView class, which provides UI-level grouping, sorting and paging functionality for any data source that implements the IEnumerable interface. This works as long as all the data that you need to sort, page are already fetched to the client which could be a slow process and can potentially consumed lots of memory on the client-side. A better solution is to provide Server-side sorting & paging. 

    One way to achieve this is to use .net RIA services’ DomainDataSource and DataPager controls which provides automatic server sorting and paging support. For more details check this out: 

    Creating applications with .NET RIA Services Part 4 – Adding a DomainDataSource

    However, if you are not using .net RIA services, than you will need to implement ICollectionView to handle sorting and IPagedCollectionView to handle paging yourself –> Silverlight 3 Custom Sorting with Paging Support – Manish Dalal’s blog

    November 3, 2009 Posted by Vincent Leung | RIA Services, Silverlight | | No Comments Yet

    Lucene tutorial

    November 3, 2009 Posted by Vincent Leung | Database, LINQ, Tools | | No Comments Yet

    Prism – Composite Application Guidance for WPF and Silverlight – October 2009

    This minor update of the Composite Application Guidance for WPF and Silverlight allows you to use the Composite Application Library with Silverlight 3. The following changes were implemented in this release:

    • All Visual Studio projects (Composite Application Library, reference implementation, and Quickstarts) were migrated to use Silverlight 3. If you do not want to upgrade to Silverlight 3, see Opening Projects with Silverlight 2.
    • TabRegionControlAdapter was modified to support binding in the TabItem’s control header in Silverlight 3. This feature was present for Silverlight 2 but stopped working in Silverlight 3 due to a breaking change. It now supports both versions of Silverlight.
    • Implemented the WeakEvent Pattern for the DelegateCommand’s and CompositeComand’s CanExecuteChanged event to fix a possible memory leak in the applications using the Composite Application Library commands. For more information, see Composite Application Library Command Memory Issues and Solution.
    • CreateXap.bat file was modified to search for Silverlight 3 assemblies if the Silverlight 2 reference assemblies cannot be found. This is to support the infrastructure required to run the Composite Application Library unit tests. Applications already using the library will not be affected

    Download details: Composite Application Guidance for WPF and Silverlight – October 2009

    October 31, 2009 Posted by Vincent Leung | Prism, Silverlight | | No Comments Yet

    MVC or Web Forms? A Dying Question

     

    Everyone who talks about ASP.NET MVC gets asked the question:

        Should I use MVC or Web Forms?

    There’s been quite a bit of debate on this topic, but in a couple years I don’t think it will matter.

    twin cars

    and the stories continues here MVC or Web Forms? A Dying Question until …

    spectrum

    The question in the next decade won’t be: “MVC or Web Forms?”.

    The question will be: “MVC or SharePoint?

    But nobody will ask the question, because the answer is easier to figure out.

    :>

    October 30, 2009 Posted by Vincent Leung | ASP.NET, MVC | | No Comments Yet