Visual Studio 2010 RC

February 9, 2010

Visual Studio 2010 RC is now available to MSDN subscribers.

http://weblogs.asp.net/scottgu/archive/2010/02/08/vs-2010-net-4-release-candidate.aspx

There are some know issues – one of them is Silverlight 4 projects are not yet supported.  “We will be adding VS 2010 RC support for SL4 with the next public Silverlight 4 drop. If you are doing active Silverlight 4 development today we recommend staying with the VS10 Beta 2 build for now.”

by xamlgeek.dk


Localization in Silverlight

February 8, 2010

It’s pretty easy to use localization in Silverlight using resoucefiles (http://msdn.microsoft.com/en-us/library/cc838238(VS.95).aspx and http://msdn.microsoft.com/en-us/library/dd882554(VS.95).aspx). Instead of using resource files it’s possible to use a database and WCF RIA Services to retrieve the localized strings. The following is an example of how to do it.

The server part

First of all I have created an entity to represent my datamodel – the entity is called LocalizatoinItem and have three properties: Key (string), Value(string) and Language (string).

LocalizationItem

To retrieve the data from the database I have created a repository called LocalizationRepository. The repository retrieves and cache data on the server.

LocalizationRepository-1

To get data in this example I have created a method to generate the it.

LocalizationRepository-3

WCF RIA Services make it easy to get data on the client from the server. To enable this, I have created a DomainService called LocalizationService. It contain a method to retrieve an IEnumerable of LocalizatoinItems.

LocalizationService

The client part

On the client side I have a class to maintain the state of the application – I have called it ApplicationState. It has a static property called Current that holds an instance of the class and a property called LocalizationStrings that will hold a list of the localized strings.

ApplicationState

When the application starts up I call the GetLocalizationItems method on the server to retrieve the localized strings. When the list of strings is retrieved I set the property in the current instance of the ApplicationState and set the RootVisual.

App

To use the localized strings in XAML I need to use DataBinding and a ValueCOnverter called LocalizationValueConverter. The ValueConverter will retrieve a specific string from the list of localized strings based on the parameter sent to the converter.

LocalizationConverter

In XAML I have made a reference to the LocalizationValueConverter.

xaml-2

To bind the strings to a TextBlock I use DataBinding and sent the key I wish to use as parameter to the LocalizationValueConverter.

xaml-1

Finally I have set the DataContext on the page to trigger the DataBinding.

MainPage

It’s properly possible to make some shortcuts compared to the steps above – but it works.

Code is available here.

by xamlgeek


2 days of Surface training

February 8, 2010

I have just completed 2 days of Surface training at Microsoft, Vedbæk. The training was done by Dr. Neil Roodyn from NSquared and hosted by Ole Kjeldsen from Microsoft, Denmark.

The training was instructive and I learned about the design principals of touchable applications. Furthermore it was great to talk to other Surface developers.

I have created a group for Surface developers in Denmark at LinkedIn – read my post about it here.

by xamlgeek


Expression Blend for udviklere

February 8, 2010

Expression Blend er en del af Microsoft Expression Studio, der er Microsofts produktpakke til designere. Selvom Expression Blend primært henvender sig til designere, kan der være en enorm fordel for udviklere i at have et godt kendskab til Expression Blend. Hvis Expression Blend udnyttes rigtigt kan det spare mange timers udvikling.

Gennem de kurser jeg løbende afholder i Silverlight, ser jeg en tydelig begejstring fra deltagerne i de muligheder de ser i Expression Blend.

Torsdag den 25. februar 2010 afholder jeg et heldags kursus for udviklere, der allerede kender til Silverlight og/eller WPF, men som godt vil have et større kendskab til Expression Blend og de muligheder det giver.

Læs mere her: http://www.eventbrite.com/event/561491436 

by xamlgeek


Silverlight 4 workshop is sold out

January 29, 2010

The Silverlight 4 workshop in January was a big success and the tickets for the workshop in February is now sold out. I have opened up for the waitlist for the February workshop and opened the sale for the Marts workshop.

You can read more about the Marts workshop here – it’s only a week after the Mix10 conference in Las Vegas.

by xamlgeek


Surface Developers in Denmark

January 26, 2010

The Surface technology from Microsoft is pretty new and is still running on its first version. Even though the hardware has been available for a few years now, it wasn’t available in Denmark until about 6 months ago. But now we got it!

Because the technology is still new and fresh, not many developers have looked at it yet – specially not in Denmark. There is a group at LinkedIn called “Surface Developers in Denmark” (http://bit.ly/8WSSgc) for all Danish Surface developers. I encourage all surface developers to join it and be part of the Danish Surface community.

by xamlgeek


DescriptionViewer in Silverlight 3

January 25, 2010

One of the new data controls in Silverlight 3 is called DescriptionViewer.

A DescriptionViewer control displays an information icon and shows a text description in a tooltip when the mouse pointer is over the icon. It also tracks validation error states so that you can implement a custom error display. It can be used to display a description by itself or be associated with another control.

To use the DescriptViewer you must add a reference to the System.Windows.Controls.Data.Input.dll assembly.

image

Used at it’s most simple form by setting the Description property this is what you will get.

image

image

As mentioned at the beginning, the DescriptionViewer control is a data control. To gain full advantage of its functionality, you need to bind data to it.

Start by looking at your data class. It’s possible to add a Display attribute to your data class. The Display attribute takes several parameters and among them a Description. Before you can use the Display attribute you need to make a reference to the System.ComponentModel.DataAnnotations.dll assembly.

image

The description parameter can be used as content to our DescriptionViewer. To accomplish that you need to point the DescriptionViewer to the control that the DescriptionViewer is related to – in this case it is the TextBox control.

image

To fill the controls with data you should add some data to the DataContext of the page.

image 

The content of the DescriptionViewer is now bound to the Description parameter of the Display attribute in your Person class.

image

All-in-all you don’t save any keystrokes by using the Description parameter on the Display attribute but it’s highly maintainable – if you decide to make changes in the data class, you don’t need to make changes to the markup.

You can download the samplecode from my DropBox.

by xamlgeek


Silverlight Facebook client

January 25, 2010

Microsoft have released the Silverlight Facebook client:

http://www.silverlight.net/content/samples/apps/facebookclient/sfcquickinstall.aspx

(requires Silverlight 4 developer beta runtime)

by xamlgeek


CNUG: Hacking your website

January 25, 2010

Kom og hør Thor Larholm fortælle og demonstrere, hvordan hackere finder huller i din asp.net application, hvordan sikkerhedsfejlene kan udnyttes og hvordan du kan beskytte sig mod dem.

Tilmelding via EventBrite: http://cnug-hacking-your-website.eventbrite.com/

by xamlgeek


CNUG: Windows Azure den 11. februar 2010

January 20, 2010

Windows Azure er Microsofts bud på cloud computing.

Kom og hør René Løhde, arkitekt evangelist hos Microsft, om hvordan og hvorfor man skal vælge Windows Azure til sine cloud applikationer.

René vil vise og forklare hvordan man hoste sin applikation i skyen, hvordan man kan tage bestik af den underliggende platform og om hvordan man bruger de omkring liggende services og APIer.

Læs mere og tilmeld jer via Eventbrite:
http://cnugazure.eventbrite.com/

by xamlgeek