Vincent Leung .NET Tech Clips

The latest tech clips from the .NET community

MEF vs Prism

There is some obvious overlap but also a clear delineation. In particular when it comes to UI composition. MEF can be used for UI composition for sure, however it doesn’t have specific UI composition bits like RegionManager, Composite Commands, EventAggregator.

In general though here are the differences.

  • First, MEF is in the platform as part of SL4/FX4.
  • Second, MEF is a general UI agnostic composition technology while Prism is specific for UI composition. MEF also extends beyond composite applications to general extensibility / plugin models.
  • Third, Prism and MEF can work together.

There are two primary use cases i hear about for MEF and Prism working together.

  1. Use Prism with MEF as an add-on for extensibility. That is make modules extensible through MEF.  You can think of this as the “Two worlds in harmony” solution. Your core architecture rests on Prism’s modularity / and an IoC Container and sits side by side with MEF.
  2. Use MEF primarily for modularity, and pull in Prism bits for UI composition.  In this model, your core architecutre sits on top of MEF, with MEF replacing the services of your IoC.

Via MEF and Prism, to be or not to be. – Glenn Block – CodeBetter.Com – Stuff you need to Code Better!

December 4, 2009 Posted by Vincent Leung | Silverlight | | No Comments Yet

Sharing Silverlight Assemblies with .NET Apps – Kind of

For SL 4 and .NET 4, the following assemblies are portable at the Siverlight surface area:

  • Mscorlib
  • System
  • System.Core
  • System.ComponentModel.Composition
  • Microsoft.VisualBasic

There are a great number of types and members in the .NET surface area that cannot run on Silverlight. As a result, you need to write code that targets the Silverlight versions of these assemblies in order to get this scenario to work.

Developers should write their portable logic in Silverlight Class Library projects, and then are free to reference such projects from both Silverlight and .NET application projects. To clarify, on the .NET side, you can reference such a library (Binary) from any kind of .NET project (Ex: WPF, winforms, WCF, WF, ASP.NET, …).

The following are the basic steps to follow to enable the use of portable code in Visual Studio 2010

Steps:

  1. Setup projects
    1. Create .NET application
    2. Create or add existing Silverlight class library project
    3. Build Silverlight project
  2. Establish portable code reference
    1. Reference Silverlight class library binary from the .NET project
  3. Code
  4. Run App!

CLR Team Blog : Sharing Silverlight Assemblies with .NET Apps

December 2, 2009 Posted by Vincent Leung | Silverlight | | No Comments Yet

Adding animation when items are added to the Silverlight Listbox

An enhancement has been made that allows you to add animation when items are added ,or removed from, the list box.  Silverlight 4 adds a new StateGroup to the ListBoxItem class:

ListBoxItemAttributes

fluidUIDemo

A Simple Demo

The user types into the text box, clicks the add button and the text “floats” up into the list.

So Where Is the Magic??

To take advantage of the new FluidUI all you need to do is to set the behavior you want on any or all of the three new Visual States in the LayoutStates group of the ListBoxItem class.

The easiest way to do this is to open the project in Blend and right click on the ListBox. Choose Edit Additional Templates –> Edit Generated Item Container –> Edit a Copy

Name the new template and then click on the ListItem and open the CreateStyleStates tab. For this simple demo, only modified the Loaded state.

To do so, click on the Loaded state and then expand the timeline. You’ll set new values for the entire Grid (which has 4 sub-elements).

select 0 seconds, and set the opacity to 0 and the  y coordinate of a translate-transform to 200.   Click save keyframe values, and then select 1 second and set the opacity to 1 and the y coordinate to 0. Save the new template…

Via Silverlight 4 Fluid UI – Jesse Liberty – Silverlight Geek

December 2, 2009 Posted by Vincent Leung | Silverlight | | No Comments Yet

Managed Extensibility Framework

December 2, 2009 Posted by Vincent Leung | MEF, Silverlight | | No Comments Yet

ZoomIt – screen zoom and annotation tool for technical presentations

ZoomIt v4

ZoomIt is screen zoom and annotation tool for technical presentations that include application demonstrations. ZoomIt runs unobtrusively in the tray and activates with customizable hotkeys to zoom in on an area of the screen, move around while zoomed, and draw on the zoomed image.

ZoomIt works on all versions of Windows and you can use pen input for ZoomIt drawing on tablet PCs.

Download ZoomIt
(129 KB)

Run ZoomIt now from Live.Sysinternals.com

Via ZoomIt

December 1, 2009 Posted by Vincent Leung | Tools | | No Comments Yet

Silverlight 4 Sessions for Business Developer

Essential

CL01 – SL4 Overview (Demo files) – Karen Corby

CL21 – Amazing Bus Apps with RIA Services (Demo files)– Brad Abrams

 

CL19 – Building LOB Apps (Demo files) – David Poll

CL20 – Trusted Apps Out of Browser (Demo files 1, 2) – Joe Stegman

Useful

CL07 – Mastering RIA Services – Dinesh Kulkarni

CL06 – Networking and Web Services in SL4 – Yavor Georgiev

FT24 – Extensible RIA with MEF – Glenn Block

CL22 – Building Large-Scale Apps with Silverlight – John Papa

December 1, 2009 Posted by Vincent Leung | Silverlight | | No Comments Yet

Eliminate duplication in CSS with .less – a .NET HTTP handler

 

One of the frustrating aspects of working with CSS (one of many, actually) is the amount of duplication in a .css file. .less help to keep your CSS files DRY using 4 constructs:

  • Variables
  • Mixins
  • Operations
  • Nested Rules

image

An HTTP handler is configured to respond to requests for the .less files.

<httpHandlers>
    <add type="dotless.Core.LessCssHttpHandler, dotless.Core" validate="false" path="*.LESS" verb="*"/>
</httpHandlers>

When a request arrives for a .less file it is the handler’s job to parse the .less file and transform it into standard CSS rule sets.

November 25, 2009 Posted by Vincent Leung | ASP.NET, UI Design | | No Comments Yet

LinkedIn Platform: Open for Business

image 

Starting today, developers worldwide can integrate LinkedIn into their business applications and Web sites. Developer.linkedin.com is now live and open for business.

November 25, 2009 Posted by Vincent Leung | Hobbies | | No Comments Yet

All about Behaviors

November 25, 2009 Posted by Vincent Leung | Expression Blend, Silverlight | | No Comments Yet

Expression Blend 3 Mini-Tutorial Screencasts

November 25, 2009 Posted by Vincent Leung | Expression Blend, Silverlight | | No Comments Yet