Windows Phone 7 MUST HAVE Toolkits

by LHayes01 2. February 2011 18:33

Windows Phone 7 MUST HAVE Toolkits

Another MUST HAVE post, but it’s well worth the read.

41cuCeDQOrL__AA115_

Tags:

Silverlight | WP7

The Reactive Extensions (Rx)... released!

by LHayes01 22. January 2011 17:36

Finally out of the labs and into the wild.

http://msdn.microsoft.com/en-us/data/gg577609

Tags:

Silverlight | Rx

Top 10 Windows Phone 7 ( WP7 ) Resources

by LHayes01 22. January 2011 09:34

Tags:

Silverlight | VS2010 | WP7

Silverlight : Removing “visibility” properties from your View Model

by LHayes01 20. January 2011 10:15

Recently a colleague of mine pointed out to me that visibility properties should not really belong in your view models.

What’s the alternative?

Use bool properties in your VM and converter.

Firstly the converter.

1 public class BoolToVisibilityConverter : IValueConverter 2 { 3 4 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 5 { 6 if (value.GetType() == typeof(bool)) 7 { 8 if ((bool)value == true) 9 { 10 return Visibility.Visible; 11 } 12 else 13 { 14 return Visibility.Collapsed; 15 } 16 } 17 return null; 18 } 19 20 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 21 { 22 throw new NotImplementedException(); 23 } 24 }

Secondly, register the converter in your XAML

1 xmlns:converters="clr-namespace:myApp.Converters;assembly=myApp" 2 3 <UserControl.Resources> 4 <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/> 5 </UserControl.Resources> 6

And thirdly, use the converter in the binding statement

1 Visibility="{Binding CommandButtonsVisibility, Converter={StaticResource BoolToVisibilityConverter}}"

Tags:

Silverlight | VS2010

500 Metro Style WP7 Icons

by LHayes01 11. January 2011 09:48

Link to blog posting(Fear and Loathing, the technical blog of Bil Simser)

500_icons_wpf_thumb_67C87FDF

Tags:

Blog | Silverlight

Using the Silverlight DataStateBehaviour - a simple example

by LHayes01 10. January 2011 11:07

Why use the DataStateBehaviour?

The DataStateBehaviour lets you change the look and feel of your XAML at runtime with the Visual States Manager in a very MVVM friendly way – best of both worlds.

Create a property (MenuIsVisible) in your view model and then you can bind the desired states in the xaml.

Binding="{Binding MenuIsVisible}" TrueState="ShowMenu" FalseState="None" Value="True"

Simple example code :

XAML

1 <UserControl 2 x:Class="DataStateDemo.MainPage" 3 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 4 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 6 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 7 mc:Ignorable="d" 8 d:DesignHeight="100" d:DesignWidth="200" 9 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 10 xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 11 > 12 13 <Grid x:Name="LayoutRoot" Background="White"> 14 15 <VisualStateManager.CustomVisualStateManager> 16 <ei:ExtendedVisualStateManager/> 17 </VisualStateManager.CustomVisualStateManager> 18 19 <i:Interaction.Behaviors> 20 <ei:DataStateBehavior Binding="{Binding MenuIsVisible}" TrueState="ShowMenu" FalseState="None" Value="True"/> 21 </i:Interaction.Behaviors> 22 23 <VisualStateManager.VisualStateGroups> 24 <VisualStateGroup x:Name="MenuStates"> 25 <VisualState x:Name="None"/> 26 <VisualState x:Name="ShowMenu"> 27 <Storyboard> 28 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="gridMenu"> 29 <DiscreteObjectKeyFrame KeyTime="0"> 30 <DiscreteObjectKeyFrame.Value> 31 <Visibility>Visible</Visibility> 32 </DiscreteObjectKeyFrame.Value> 33 </DiscreteObjectKeyFrame> 34 </ObjectAnimationUsingKeyFrames> 35 </Storyboard> 36 </VisualState> 37 </VisualStateGroup> 38 </VisualStateManager.VisualStateGroups> 39 40 <Button Command="{Binding ShowMenuCommand}" Height="20" Width="150" HorizontalAlignment="Center" VerticalAlignment="Top">Show Menu</Button> 41 42 <Grid x:Name="gridMenu" Visibility="Collapsed" Height="50" Width="150"> 43 <StackPanel> 44 <TextBlock>First Menu Item</TextBlock> 45 <TextBlock>Second Menu Item</TextBlock> 46 </StackPanel> 47 </Grid> 48 49 </Grid> 50 </UserControl>

Code Behind

1 using System.Windows.Controls; 2 3 namespace DataStateDemo 4 { 5 public partial class MainPage : UserControl 6 { 7 public MainPage() 8 { 9 InitializeComponent(); 10 Loaded += (s, e) => 11 { 12 DataContext = new MainPageViewModel(); 13 }; 14 } 15 } 16 }

View Model

1 using System; 2 using System.Linq.Expressions; 3 using System.Windows.Input; 4 using GalaSoft.MvvmLight; 5 using GalaSoft.MvvmLight.Command; 6 7 namespace DataStateDemo 8 { 9 public class MainPageViewModel : ViewModelBase 10 { 11 public ICommand ShowMenuCommand { get; private set; } 12 13 private bool menuIsVisible; 14 15 public MainPageViewModel() 16 { 17 ShowMenuCommand = new RelayCommand(() => { MenuIsVisible = !MenuIsVisible; }); 18 } 19 20 public bool MenuIsVisible 21 { 22 get { return menuIsVisible; } 23 set 24 { 25 menuIsVisible = value; 26 RaisePropertyChanged(() => MenuIsVisible); 27 } 28 } 29 30 #region INotifyPropertyChanged 31 32 protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyAccessor) 33 { 34 MemberExpression member = (MemberExpression)propertyAccessor.Body; 35 RaisePropertyChanged(member.Member.Name); 36 } 37 38 #endregion 39 } 40 }

Tags:

VS2010 | Silverlight

Free eBook : Microsoft Press ebook: Programming Windows Phone 7

by LHayes01 5. January 2011 15:59

Tags:

Merry Christmas!

by LHayes01 24. December 2010 11:28

Wishing you a very Merry Christmas and a Happy New Year 2011.

computerchristmas

Tags:

Samsung Omnia 7 / Focus must have accessories

by LHayes01 23. December 2010 12:30

If you have one of these fantastic Windows phones, there are 2 accessories you must get.

1) JVC HA-FXC50-B High Quality In-Ear Canal Headphones – Black

http://www.amazon.co.uk/gp/product/B001NS62PA/ref=oss_product

2) Griffin SmartTalk Headphone Adapter and Control Mic For iPhone and Mobile Phones

http://www.amazon.co.uk/gp/product/B001C0LBEG/ref=oss_product

The headphones give you a great sound and real bass plus the SmartTalk creates a long lead and the ability to change music tracks without having to pickup the phone, open plan office based developer heaven!

Thanks for @RobFe for both recommendations.

41cuCeDQOrL__AA115_ 31tAwh4p4FL__SY100_ 31W2ZRyBngL__SY100_

Tags:

Locate file in Solution Explorer Shift–ALT-L

by LHayes01 16. December 2010 14:43

This one is a life saver, Shift-ALT-L to locate the current file in the Solution Explorer Tree.

Locate

Tags:

Silverlight | VS2010

Microsoft Silverlight 4 Tools for Visual Studio 2010 - Updated

by LHayes01 15. September 2010 16:37

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b3deb194-ca86-4fb6-a716-b67c2604a139&displaylang=en

Released 2nd of September 2010, this install removes the previous installation first.

Tags:

No Splash

by LHayes01 15. September 2010 16:34

Old one this but still good.

devenv.exe /nosplash

Faster start up for VS2010.

Tags:

VS2010

Back from the deep

by LHayes01 31. August 2010 22:24

I’ve managed to wrestle control of my blog back from the hackers and spammers, I should be blogging again real soon!

Thanks for the support.

Victory

Tags:

VS 2010 Productivity Power Tools – Updated

by LeeRoystonHayes 28. July 2010 14:11

Tags:

VS2010

Keeping in Sync

by LeeRoystonHayes 19. July 2010 09:53

Great little utility to get photo’s from Facebook into Outlook:

http://outsync.codeplex.com/

Outlook Social connector (with support for LinkedIn):

http://www.microsoft.com/downloads/details.aspx?FamilyID=c87e257c-d76f-4785-a09b-af36babd6e32&displaylang=en

Outlook Social Connector Provider for Facebook:

http://www.microsoft.com/downloads/details.aspx?FamilyID=ce8b7517-234c-48a1-a655-324a88893b02&displaylang=en

Tags: , ,

Outlook | Facebook | LinkedIn

VS2010 Incremental Search

by LeeRoystonHayes 1. July 2010 14:45

In the editor Ctrl-I to change to incremental search mode.

The cursor changes to a pair of Binoculars with a green arrow and the status bar displays “Incremental Search”.

Start Typing and the first match is highlighted, Ctrl-I again to move to the next match, Ctrl-Shift-I to move back.

Escape to return to normal mode.

IncrementalSearch

Tags:

VS2010 Copy n Paste stack

by LeeRoystonHayes 1. July 2010 14:22

Copy “A” (Ctrl-C), copy “B” (Ctrl-C), copy “C” (Ctrl-C).

Ctrl-Shift-V once to paste “A”, twice to past “B” and three times to paste “C”!

Tags:

VS2010

Really Simple Guide to : Silverlight 4

by LeeRoystonHayes 28. June 2010 15:08

Here is my take on the really useful bits in order.

- MEF

- ICommand Support

- Right Click Menus

- Text trimming / formatting, Null Values and Fallback Value.

- Out of Browser

- Printing API

- Dependency binding

- Microphone and Webcam support

There and many many more improvements, not least the re-write of the XAML parser, but these are the most useful to me in the field. I hope to in the next few days do a look at each one and produce a sample with each.

Tags:

Glorious Food

by LeeRoystonHayes 23. June 2010 09:17

A little off topic this one, but if like me you love food this website is great.

http://www.bbc.co.uk/food/recipes/

Tags:

Edge User Group meeting “Real World Silverlight and Windows Phone 7” – review

by LeeRoystonHayes 21. May 2010 09:27

Here is a brief summary review of the important points.

1) MVVM-C, Model-View-ViewModel-Controller.

To keep ViewModel light and small consider introducing a controller per VM that sits behind and performs all the service access and business logic. Why? To make the VM smaller and lighter and also perform service access in a background worker thread and marshal the results to the UI thread (VM) at the last possible moment.

This makes perfect sense to me and I have experienced VM bloat. Ray Booysen who gave the talk is a Silverlight programmer in the financial services sector and specialises in low latency systems.

2) Use the enableRedrawRegions and enableFrameRateCounter options.

By enabling these two options, it becomes very clear where you interface is redrawing during operation and avoiding the drop shadow effect is a must (this redraws the entire control and ever other control in the visual tree following).

3) Debugging and the SOS dll.

4) Unit Testing

The Silverlight Unit testing framework runs on the full .net stack (not the SL stack) and tests that pass in the unit tests may fail in SL.

http://edgeug.net/

Tags: ,

Silverlight | VS2010

VS2010 IDE Navigator

by LeeRoystonHayes 18. May 2010 14:57

Control + Tab bring up the VS2010 navigator, Control + Tab again to move forward through the items.

Control + Shift + Tab, move back through the items.

IDENavigator

Tags:

VS2010

VS2010 Desktop Wallpapers

by LeeRoystonHayes 17. May 2010 09:38

Tags: ,

VS2010

First Silverlight behaviour published, ShowHideWithFlip

by LeeRoystonHayes 14. May 2010 16:35

Today I have published my first Silverlight behaviour to the expression blend gallery.

http://gallery.expression.microsoft.com/en-us/ShowHideWithFlip

Please vote for me!

 

Tags: ,

Silverlight

Visual Studio 2010 Image Library

by LeeRoystonHayes 14. May 2010 14:03

Did you know VS2010 comes with a library of icons, png’s, and bitmaps?

Navigate to :

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\VS2010ImageLibrary\1033 (Win 64)

or

C:\Program Files\Microsoft Visual Studio 10.0\Common7\VS2010ImageLibrary\1033 (Win 32)

and find file VS2010ImageLibrary.zip.

Tags:

VS2010

VS2010 Code Metrics

by LeeRoystonHayes 14. May 2010 09:21

Right click your project and select “Calculate Code Metrics”.

I’m looking for a good detailed explanation of exactly what the metrics are so if you have any good links please email them to me and I will re-post here.

CodeMetrics

CodeMetrics2

Tags:

IDE | VS2010

VS2010 Extension Manager

by LeeRoystonHayes 7. May 2010 09:10

One place to manage all the extensions in the VS2010 IDE.

ExtensionManager

Click the “online gallery” tab to see many more options to download.

ExtensionManager2

Tags:

VS2010

Parallel.ForEach()

by LeeRoystonHayes 5. May 2010 09:29

To take advantage of the multi core’s in your servers and desktops .net 4 has many multi thread programming extensions.

“Parallel.ForEach” is one such extension, and the gottcha?

The loop is not always processed in the same order.

In this simple example the list of names comes out in a different order each time.

Parallel

Tags: , ,

VS2010

Optional and named parameters

by LeeRoystonHayes 30. April 2010 10:03

Named optional parameters with default values new in c# 4.0!

Optional

Optional2

Tags: ,

VS2010

Pin Projects to the start page

by LeeRoystonHayes 29. April 2010 13:14

You can now “pin” a project in the Recent Projects list on the start page to keep your live work at the top. Hover over the area to the left of the project name and click to pin and un-pin.

PinProjects

Tags:

IDE | VS2010

Multi Monitor Support (Floating panels)

by LeeRoystonHayes 29. April 2010 09:17

You can dislocate panels from the VS2010 IDE and float them over to another monitor. Click and drag from the tab bar and you window is free!

MultiMonitorSupport

Tags:

IDE | VS2010

About me

Freelance C#/Silverlight developer working in London, England.

Website.

LinkedIn.

RecentComments

Comment RSS