How to highlight current file in Solution Explorer

To highlight the current open file in Visual Studio’s Solution Explorer you must enable the ‘Track active item in Solution Explorer’. To enable this follow these simple steps:

  1. In Visual Studio 2010 click on the Tools menu
  2. Select Options
  3. Select Projects and Solutions
  4. Select General
  5. Tick ‘Track active item in Solution Explorer’
  6. Click OK

VS2010 File Highlighting in Solution Explorer

Windows 8: WinRT Error – The given System.Uri cannot be converted into a Windows.Foundation.Uri

I was trying to directly set the source of an image to the path within the assembly. Previously you built up the Uri to include the assembly name and the path to the asset. Just like below but this now throws an error.

            // ;Component/ must all ways be present in the Uri below
            Uri uri = new Uri("VJComponent;Component/Assets/joystick.png", UriKind.Relative);
            BitmapImage bi = new BitmapImage();
            bi.UriSource = uri;

The given System.Uri cannot be converted into a Windows.Foundation.Uri

Replace the assembly name and ‘;Component/’ with ‘ms-appx:/’ and build the Uri as before.

            Uri uri = new Uri("ms-appx:/Assets/joystick.png");
            BitmapImage bi = new BitmapImage();
            bi.UriSource = uri;

To do the same but directly in the XAML instead of doing it programmatically you previously did this


Again replace the assembly name and ‘;Component/’ with ‘ms-appx:/’ and build the Uri as before.


Windows 8 Developer Camp Slides

Here are the slides from the Windows 8 Developer Camp I recently attended

[gview file=”http://allanmuller.co.uk/wp-content/uploads/2012/05/Agenda.pdf” authonly=”1″]

[gview file=”http://allanmuller.co.uk/wp-content/uploads/2012/05/Overview_MikeT.pdf” authonly=”1″]

[gview file=”http://allanmuller.co.uk/wp-content/uploads/2012/05/Views_MikeT.pdf” authonly=”1″]

[gview file=”http://allanmuller.co.uk/wp-content/uploads/2012/05/ControlsBinding_MikeT.pdf” authonly=”1″]

[gview file=”http://allanmuller.co.uk/wp-content/uploads/2012/05/Media_MikeT.pdf” authonly=”1″]

[gview file=”http://allanmuller.co.uk/wp-content/uploads/2012/05/PLM_MikeT.pdf” authonly=”1″]

 

Create WinRT Component DLL in C#

There are loads of tutorials on how to create a WinRT Component DLL in C++ but there aren’t many on how to do this with C#. In fact it is pretty simple:

Step 1: Add a C# Class library project to your solution

Step 2: Right click on the new project you have just added and go to properties.

Step 3: Change the output type from ‘Class Library’ to ‘WinMD File’.

Change from Class Library

Change to WinMD File

Step 4: Ensure your class inside the newly created Class Library is sealed. The Windows Runtime classes you create must be sealed.

Make sure you set your class to sealed

HTML5 – My adventures….

So I have been keeping an eye on HTML5 for a while now. I am pretty confident using Javascript (hey I wrote close to 500k lines for a Silverlight 1.0 project). I am not going to shift away from C#/XAML as I honestly believe they are my bread and butter, but there is no harm in having a play with HTML5.

I like the MVVM pattern as I feel my code is cleaner. I guess it’s because I feel comfortable with it but it’s great to see KnockoutJS being adopted to allow this pattern into the HTML5/JS world.

I have started using KineticJS today to start and again I am impressed with it.

Windows 8: MVVM and SettingsPane issue?

Today I reported to Microsoft that there appears to be an issue with the SettingsPane in Metro apps built using the MVVM pattern. The app throws an ‘System.AccessViolationException’ throws when you call SettingsPane.Show();

I have emailed over the code to Matt Small (Microsoft) and hopefully I will hear back shortly.