Tips & Tricks

If you are creating Windows Services you may run into this error:

Error 1001. The specified service has been marked for deletion

At first I used to restart my machine to get rid of it, but there is a (much) simpler way: close the Services Manager and you will never encounter this error!



when you are developing your applications using VS 2010 and unfortunately your TFS server became unreachable, your Visual Studio 2010 stuck!
Since you are unable to tell to VS that your TFS is unreachable you should waiting for VS until it detects that is unable to connect to TFS… This is really annoying and this makes you wasting your precious time…

Bernhard Tschirren has developed a VS addon for adding the Go Off Line button into VS Source Control Menu! Using this button befor opening your your .sln you can avoid the VS stuck even if your TFS is offline πŸ™‚

Here you are the GoOffline VS Ads link (for installing just double click it after downloading): Click Here

Happy coding and stay tuned!

Today I just want to provide a quick fix for removing Black Background Popup in WPF.
For removing Black Background you just need to set AllowsTransparency property to True, and that’s all πŸ˜‰
And, off course, after that you can insert a Border, as well as a Grid, and setting your preferred background color.

<Popup PlacementTarget="{Binding ElementName=myUIElement}"
           VerticalAlignment="Center" >

   <Border Background="White" ...




Today I would like to introduce Snoop, a good WPF utility for exploring your Application at run-time.
One of the most problem during the development of WPF Applications is to guess the VisualTree of your UI elemements at runtime. Of course, Microsoft Express Blend is an useful application Β in your UI development, but it cannot help you in discovering the VisualTree during run-time. For achieving this purpose you can download and install Snoop, a good VisualTree explorer for WPF Applications. Using Snoop you can:

  • viewing the visual tree graph,
  • zooming some UI parts
  • 3D zooming for seeing all the UI elements composing your application
  • having more information about routed events

Snoop is a free tool availabe here, and below are some screenshots:

Today I discovered how to retrieve in C# the Double Click Speed set on Windows control panel.
You can getting it viaSystem.Windows.Forms.SystemInformation.DoubleClickTime property πŸ˜‰

Happy coding

Hi guys,
I want to introduce you to two .NET classes used to identify the screen resolution and also to handling the change of screen resolution:

  • SystemParameters: allow you to retrive a lot of useful system information, including the screen size. In the specific case the screen size is SystemParameters.PrimaryScreenWidth and SystemParameters.PrimaryScreenHeight
  • SystemEvents: this class contains a lot of useful events that allow you to be notifyed about useful system changes.Β  In the specific case the event SystemEvents.DisplaySettingsChanged is raised every time the screen resolution chage.

The following example code illustrates how to use them:

public partial class Window1 : Window
public Window1()


SystemEvents.DisplaySettingsChanged +=
new EventHandler(SystemEvents_DisplaySettingsChanged);

void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)

private void ShowScreenResolution()
MessageBox.Show(String.Format("Screen Resolution: {0}x{1}",


What you have to do for specifying a background color for highlighting an item of a ListView is simply add to your <ListView.Resources> the following SolidColorBrush:

        <ListView ScrollViewer.VerticalScrollBarVisibility="Visible"
                  ItemsSource="{Binding Path=myFileCollection}">

                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"


The first SolidColorBrush overrides the Windoes Highlight Brush for indicating a selected item having the focus. The second SolidColorBrush is used for overriding the default Windows Brush used for indicating a selected item that doesn’t have a focus.