Wednesday, October 27, 2010
Tuesday, October 26, 2010
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> SelectionChangedCommandand (in the MainViewModel constructor):
{
get;
private set;
}
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 |
Friday, October 22, 2010
Friday, October 15, 2010
Silverlight Offline Mode
|
|
|
|
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
|
|
|
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'
Wednesday, October 06, 2010
Silverlight – Message Box
How to make a Silverlight MessageBox.Show that waits until a choice is made ? – Forum http://forums.silverlight.net/forums/t/155304.aspx |
Refactoring Silverlight ChildWindow for a non-modal use – Tim Heure ** http://timheuer.com/blog/archive/2009/05/10/silverlight-childwindow-non-modal-refactor.aspx |
Others * |
Threading
Using Delegates Asynchronously - O'Reilly Media http://ondotnet.com/pub/a/dotnet/2003/02/24/asyncdelegates.html |
Sunday, October 03, 2010
Refactoring
Martin Fowler http://www.refactoring.com/sources.html |
Neil Ford: 10 Ways to Improve Your Code - InfoQ http://www.infoq.com/presentations/10-Ways-to-Better-Code-Neal-Ford http://nealford.com/downloads/10_Ways_to_Improve_Your_Code(Neal_Ford).pdf |
Neal Ford – The Productive Programmer... Part 1 http://www.nealford.com/mypastconferences.htm |
Code Smells Listing http://wiki.java.net/bin/view/People/SmellsToRefactorings |
Refactoring – examples from the book (Java/JUnit) http://david.koontz.name/home/Projects/Entries/2008/4/13_Photo_of_the_Day.html |
Refactoring – Chapter 1 (C#) http://www.thycotic.com/articles/refactoring/Csharphandout.pdf |