Introduction

As most .NET programmers no doubt already know, casting is required when converting from one type to another type when information might be lost, also now as narrowing conversions.  In C# there are two different ways to cast:

1) Casting using the prefix style

object value1 = 123;
string value2 = (string)value1;

 

2) Casting using the “as” keyword

object value1 = 123;
string value2 = (value1 as string);

There are some simple and arbitrary reasons to use one of these over the other.  Perhaps the most arbitrary reason people use one method or the other ...

Read more about it here. Among other things we will have live tiles, front and back, background processing via agents, Silverlight 4, mixed XNA and Silverlight, profiling tools, improved emulator, more sensors and sensor APIs, fast application switching, local SQL, IE9 and access to the calendar. Very exciting!

The actual download is here. You cannot install it side by side with the WP7 tools, but the new 7.1 can target both the new and old versions.

Resizable TileView

The Telerik Silverlight TileView control gets better with every release.  One of Telerik’s more recent additions to this control is the ColumnsCount and RowsCount property which gives you an easy way to dynamically adjust the size and number of columns per column or row.  Before this property was added, doing this would require your own logic to figure out how many tiles there were to set the height and width of each tile.

There are a lot of different ways to allow a user to change these values, but I will demonstrate using a RadSlider to adjust the TileView tiles. ...

 

I’ve been to a lot of technical conferences, both as a presenter and attendee, so I feel at least somewhat qualified to offer my opinion of the recent Google IO conference in San Francisco. I am not here to enumerate the product announcements or offer my in-depth opinion on every topic, you can find all you want of that (and more) out on the web.  Instead I am going to try and convey the general feeling and impression I got from the event, colored with my years of experience in the software industry.

 

 

Geeks, gadgets, and giveaways...

I’m sure once you have tried to use DataTemplates in certain controls you will notice that if you give a name to an element you cannot access that element outside the DataTemplate. This makes sense because there will end up being many of these items created in a template and the name you give the element will not be unique. So how would you set an element’s property in the DataTemplate that comes from a FrameworkElement property? It can be done with Dependency Properties.

 

As a side note, the Dependency Properties in this example will work around the issue ...

EventBoard is now loaded with the data for Microsoft TechEd 2011 in Atlanta, Georgia. You can use it on your Windows Phone 7, iPhone or Android device for free! Come visit our booth at TechEd, #1347.

I love the M-V-VM pattern for Silverlight and WPF applications.  It’s beautiful and works very well, but sometimes it is too verbose, particularly in the ViewModels’ INotifyPropertyChanged implementations.  I find that I spend too much time on the repetitive plumbing tasks that could otherwise be spent programming the actual application logic.

There are many tools and frameworks out there to speed up and simplify MVVM (Caliburn, MVVM Light, WAF, etc.), but I just discovered a very simple tool that goes a long way toward making MVVM more useable. 

It’s called NotifyPropertyWeaver and it solves the problem ...

This is just a snippet that showcases how to use the PIVOT statement to turn a column of dates into a calendar-like result set. It uses a sequence/numbers/tally table as a convenience as well. For info on what this table is and what it is for, see this excellent article on the topic. Here is the code:

if (object_id('sequence',  'u')  is  null)
begin  select  top 65536  identity(smallint, -32768, 1)  as n
     into  sequence  from master.sys.columns a
     cross  join master.sys.columns b
end  GO  if (object_id('PK_Sequence',  'pk')  is  null)
begin  alter...