Thursday, January 15, 2015

how to make button click work in listview on universal app ( xaml & WinRT)

If you are following MVVM pattern or using a datatemplate and trying to have a button inside a ListViewItem but the button click not working (not triggering the command), this might help.

The button gets binded to the item on the collection and if you want to manipulate the collection bound to listview, the command in most cases you might have it at the ViewModel bound to the listview. so make the button command bind to the listview data binding as below..







                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

                                <Button Content="x" HorizontalAlignment="Left" VerticalAlignment="Center" Command="{Binding ElementName=ItemListView, Path=DataContext.RemoveButtonCommand}" CommandParameter="{Binding}"></Button>

                                <TextBlock Text="{Binding Title}"></TextBlock>





In above code, I'm setting the binding to the listview element by name and set the binding path to the elements datacontext and the command exposed through a property on the viewmodel bound to the listview.

The viewmodel would be something like this.
public myViewModel()

     this.RemoveButtonCommand = new RelayCommand(this.RemoveButtonCommandExecute);

public ICommand RemoveButtonCommand { get; set; }

please let me know in commands if this is useful or if you think more details/explanation would be helpful.

Thursday, September 5, 2013

how to generate nested xml from database/table using sql queries

[I’ve been focusing on Frontend development for some time and didn’t had an need to explore FOR XML command on SQL server. But I when I needed it today, felt its an awesome feature. Adding this post here as the search engines pointed me to how to write complex stored procedures for this instead of redirecting to nested For XML queries.]
I was working on migrating some of the features to Azure and there was data XML with complex structure, I wanted to move to relational data base and build WebAPI’s to expose the functionality to be used by many frontend clients running outside Azure. So I created all the relational tables in SQL Azure and wrote the stored procedures etc. A blocker question came in as a requirement on this feature should work if Azure goes down (yup, rare but I work on critical app which shouldn’t have any downtime) and we don’t the old app to work without much changes. After thinking through caching & performance, decided to generate the XML output from SQL itself and pass it on for current applications that are not in Azure (and save cost by get bulk and cache it and reducing chattiness).
Binged on creating XML in stored procedure and got many forums explaining how to create XML nodes, optimize it with Cursors, etc. wrote the full sp and accidently noticed the For XML clause. Explored further and found it was a simple and powerful with nested For XML queries and I got the whole legacy XML with <10 line query and still keep the well designed DB tables and names.
The MSDN has detailed info with many examples to refer, so not adding much here..
An example from MSDN for quick reference…
SELECT ProductCategoryID, Name as CategoryName,
       (SELECT ProductSubCategoryID, Name SubCategoryName,
               (SELECT ProductModel.ProductModelID,
                       ProductModel.Name as ModelName,
                       (SELECT ProductID, Name as ProductName, Color
                        FROM   Production.Product
                        WHERE  Product.ProductModelID =
                        FOR XML AUTO, TYPE)
                FROM   (SELECT distinct ProductModel.ProductModelID,
                        FROM   Production.ProductModel,
                        WHERE  ProductModel.ProductModelID =
                        AND    Product.ProductSubCategoryID =
                FOR XML AUTO, type
        FROM Production.ProductSubCategory
        WHERE ProductSubCategory.ProductCategoryID =
FROM Production.ProductCategory
ORDER BY ProductCategoryID
~ Tony Julien

Wednesday, January 30, 2013

How to permanently delete an TFS branch

Delete context menu on TFS Source Control explorer will not purge the files and also it need you to get the latest and then delete (more steps), but it does not purge the files.


If you want to permanently delete a TFS branch, use “tf destroy” command on the VS command prompt. Incase if you want to keep the history add “/keephistory” to it.



tf destroy “<branchPath>"


Destroy Command msdn link has full details:


[It’s been sometime, I purged an branch and I wanted to quickly get the purge comment again and search on Bing and google with keyword permanently delete tfs didn’t bring relevant answer, so thought I’ll post it for permanently delete.]






Thursday, June 23, 2011

Tip: How to display an icon(on address bar/favorites/bookmark) to a webpage

Resolves these:

·         If you are wondering why you are getting event logs with favicon.ico file not found

·         If you are interested in having a custom icon for your webpage on the address bar of the browser (shown in front of the url ) or favorites or bookmark to your page.




Add the following link tag with the href set to the icon you want to display:


<link href="" rel="shortcut icon"/>

Friday, January 29, 2010

What’s New in Windows Presentation Foundation 4

What’s New in Windows Presentation Foundation 4

Click here to Navigate to the videos series on

This series of short, “how-to” videos will introduce the various new features that have been added to WPF with .NET 4.0. Each video provides a code-focused look at how you can leverage a new feature or set of features in your WPF applications.

Thursday, November 19, 2009

Windows Identity Foundation

Windows Identity Foundation Overview:

Click here to the Session on to
Hear how Windows Identity Foundation makes advanced identity capabilities and open standards first class citizens in the Microsoft .NET Framework. Learn how the Claims Based access model integrates seamlessly with the traditional .NET identity object model while also giving developers complete control over every aspect of authentication, authorization, and identity-driven application behavior. See examples of the point and click tooling with tight Microsoft Visual Studio integration, advanced STS capabilities, and much more that Windows Identity Foundation consistently provides across on-premise, service-based, ASP.NET and Windows Communication Foundation (WCF) applications.

Tuesday, November 3, 2009

Microsoft Silverlight 3 Series - On demand Web Seminars


Microsoft Silverlight 3 Series

This series of on demand web seminars will walk through the technology fundamentals, data, graphics, and .NET RIA Services of Silverlight 3.

Click here to navigate to Microsoft Silverlight 3 Series at