Tuesday, October 26, 2010

Handling DataGrid.SelectedItems in an MVVM-friendly manner

Handling DataGrid.SelectedItems in an MVVM-friendly manner: "

An interesting question from one of the MVVM Light users today:

Is there an MVVM-friendly way to get a DataGrid’s SelectedItems into the ViewModel?

The issue there is as old as the DataGrid (that’s not very old but still): SelectedItem (singular) is a DependencyProperty and can be databound to a property in the ViewModel. SelectedItems (plural) is not a DependencyProperty.

Thankfully the answer is very simple: Use EventToCommand to call a Command in the ViewModel, and pass the SelectedItems collection as parameter. For example, if the command in the ViewModel is declared as follows:

public RelayCommand<IList> SelectionChangedCommand
{
get;
private set;
}
and (in the MainViewModel constructor):
SelectionChangedCommand = new RelayCommand<IList>(
items =>
{
if (items == null)
{
NumberOfItemsSelected = 0;
return;
}

NumberOfItemsSelected = items.Count;
});

Then the XAML markup becomes:

<sdk:DataGrid x:Name="MyDataGrid"
ItemsSource="{Binding Items}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<cmd:EventToCommand
Command="{Binding SelectionChangedCommand}"
CommandParameter="{Binding SelectedItems,
ElementName=MyDataGrid}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</sdk:DataGrid>

I slapped a quick sample and published it here (VS2010, SL4 but the concept works in SL3 and WPF too).


Cheers!


Laurent



"

Monday, October 25, 2010

WCF

WCF : BasicHttpBinding compared to WSHttpBinding at SOAP packet level. ***
http://geekswithblogs.net/claeyskurt/archive/2008/04/22/121508.aspx
Winterdom » Blog Archive » WCF Configuration Complexity **
http://winterdom.com/2007/02/wcfconfigurationcomplexity
WCF Binding: BasicHttpBinding vs WsHttpBinding - Fabian's Blog **
http://www.apexa.net/Blog/web_design_Blog_20080911.aspx
Configuring Message Logging – MSDN **
http://msdn.microsoft.com/en-us/library/ms731859.aspx

Stephen Covey’s Five Metastasizing cancers


Watch out for an organizational culture that produces any of these five:
1.    Criticizing
2.    Complaining
3.    Comparing
4.    Competing
5.    Contending

The above culture shows a victim mentality. Instead, strive to uphold the following values in your organization:
1.    Gratitude
2.    Forgiveness
3.    Abundance

Websites

Interview
You need to identify this type of applicant quickly & the quickest way is the short coding interview. You don't even have to have them come into the office.
Get a private site right here where you can watch your job candidate write code over the internet in real-time.
http://i.seemikecode.com/
 
Task management - Online
http://www.producteev.com/
 
Photo Gallery
http://tympanus.net/codrops/2010/06/27/beautiful-photo-stack-gallery-with-jquery-and-css3/
 
Simple Diagrams
A small desktop application that helps you express your ideas quickly and simply.
There's just enough functionality to describe a thought or capture a process.
It keeps the visual expression clear through the simple design of library items and backgrounds.  

http://www.simplediagrams.com/

 

We Used To Wait
http://www.thewildernessdowntown.com
An interactive short film for Arcade Fire's "We Used to Wait" track, utilizing Google's Chrome Browser, Google Maps and HTML5
http://www.thefwa.com/article/fwa-site-of-the-year-2010

Wednesday, October 13, 2010

The Debut Of Cheteshwar Pujara

2nd Test: India v Australia at Bangalore - Oct 9-13, 2010

India 2nd innings (target: 207 runs)

CA Pujara b Hauritz 72 (89)

What a knock, though. You wait five years for the call from selectors. You keep scoring runs.

You finally get that call. You wait for six hours to bat and you get a grubber, a shooter.

You then get promoted ahead of your idol Rahul Dravid in the second innings. And play a super knock. Sometimes, dreams do come true. Sometimes..

http://www.cricinfo.com/india-v-australia-2010/engine/current/match/464527.html

Tuesday, October 12, 2010

Silverlight Applications

Tech Tools

 
 
 

Design Patterns

 
 

Monday, October 11, 2010

Coca Cola India – Diwali 2010 Ad

here are the lyrics

jaata kahan hai diwane.. sab kuchh yahaan hai sanam
jab honge hum sath tere.. khushiya chalen sang sang
o raaja tu aaja.. humare sang aaja.. o jhum le zaraa!

ita remix of a song form 1956 movie 'C.I.D'

Download http://cid-7786a33555a957e5.office.live.com/self.aspx/Music/Coca%20Cola%20-%202010%20-%20Diwali%20Special.mp3