Sunday, January 16, 2011

Silverlight Toolbox GestureListener not working great when developing using Remote Desktop

The Silverlight for Windows Phone Toolkit is working fine in normal environments, great toolkit. However when I started developing WP7 apps in the living room and used a Remote Desktop connection to the development machine I encountered very bad gesture responses in the Windows 7 Emulator. The Flick gesture on the emulator screen didn't do anything (well about 1 out of 100). Doing it again 1 minute later on de development machine without RDS and it worked all the time. Other gestures worked fine. Maybe it's something with the mouse events?

The XAML code I used:

<toolkit:GestureListener Flick="GestureListener_Flick">

Code behind:

   1: if (ViewModel.ViewModelLocator.MainStatic.TossCmd.CanExecute(e))
   2: {
   3:     ViewModel.ViewModelLocator.MainStatic.TossCmd.Execute(e);
   4: }

Setting a breakpoint on line 1 never kicked in.

Friday, January 7, 2011

Property Bag issues

This time a minor blog post. It’s more for myself so I don’t forget.

This time it’s about the property bag in various object in SharePoint 2010. The problem I came across was how to remove a property bag key-value. But lets start at the beginning.

1- Add an value to the property bag.
//set value on (a new) Property bag 
if (web.Properties.ContainsKey("ExpireOn"))
web.Properties["ExpireOn"] = "some sting";
web.Properties.Add("ExpireOn","some string");

2- Remove an item from property bag

//Remove Property bag  
//Does not work

//Does work
web.Properties["ExpireOn"] = null;

As you can see, using Remove doesn’t work. You should set the value to null, call Update() on properties to persist the change to the database. At this point the null-ed Property bag key-value will be removed from the collection.