Colour converter based on Status string.

Declare a class and inherit from the IValueConverter using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Windows.Data; public class StatusColorConverter:IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string status = (string)value; if (value == null) { return... Continue Reading →

Multiple Silverlight Application to Web Application

Visual Studio 2010 allows to add multiple Silverlight Projects to the Solution. These silverlight projects can be added to the single web application project. To add multiple Silverlight Project to the Web Application, select the Web Application and right click and go to Properties   In the properties page there will be a Silverlight Application... Continue Reading →

LINQ to XML using join, group by order by query

We can use LINQ to write a complex query like join and group by operations. The below sample shows a simple join query and the group by command in 2 XML files. I use the 2 xml files firstxml.xml and secondxml.xml FirstXml.Xml <dataroot>  <Names>    <NAME_ID>1121</NAME_ID>    <PARENTS_NAME_ID>Selvan</PARENTS_NAME_ID>  </Names>  <Names>    <NAME_ID>1122</NAME_ID>    <PARENTS_NAME_ID>Sen</PARENTS_NAME_ID>  </Names></dataroot> SecondXml.Xml <dataroot>  <Info>    <INFO_NAME_ID>1121</INFO_NAME_ID>   ... Continue Reading →

How to Create Irregular Shape Controls Silverlight

To draw the irregular shape objects in Silverlight we can use the Polygon and Path. Polygon has multiple points separated by space. Using these points we can draw any shape. The other option is the path. Using path its easy to draw a curve and irregular objects. Below XAML will draw two objects. <UserControl  xmlns=""... Continue Reading →

Entity Framework Connection String

  Code Snippet using System.Data.EntityClient;               EntityConnectionStringBuilder entityConString = new EntityConnectionStringBuilder()             {                 Metadata = @"res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl",                 Provider = "System.Data.SqlClient",                 ProviderConnectionString = new System.Data.SqlClient.SqlConnectionStringBuilder                 {                     InitialCatalog = dbname,                     DataSource = servername,                     IntegratedSecurity = false,                     UserID = user,                     Password = pwd                 }                   .ConnectionString             };             return entityConString.ToString();

Get Logged In User while Impersonate or Run as Admin

Sometimes when a program is run as Administrator, using the System.Security.Principal.WindowsIdentity.GetCurrent().Name will return always System or NT Authority\System. This happens while running the exe under windows service or by Installer class in the windows application. The below code will solve this issue. Code Snippet public static string GetParentUser(int pid)         {             string parentUserAccount = null;             string... Continue Reading →

Create a website or blog at

Up ↑