#723 – Turning Off All Caps Menus in Visual Studio 2012

One of the changes in Visual Studio 2012 was to render the main menus in all caps.  This was done to better match the new Metro (Windows Store) style of user interface, used across other Microsoft products.  (E.g. Office 2013 or the Bing web site).

747-001

However, many people have argued that using all caps make the user interface less readable and constitutes bad typography.

If you prefer using upper and lowercase in the main menu, you can turn off the all caps by adding a value in the registry.

In the key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General, create a DWORD value named SuppressUppercaseConversion and set its value to 1.

You’ll now get upper and lowercase in the menus.

747-002

#722 – Get a Free Copy of Visual Studio 2012

You can start developing WPF applications by using the Visual Studio 2012 Express edition listed below.  This edition is free and allows you to create WPF applications for the desktop.

  • Visual Studio Express 2012 for Windows Desktop

Additionally, you can get a free copy of Visual Studio Team Foundation Server Express 2012, which allows up to five developers to do source code control, work item tracking, and build automation.

#413 – Creating a Grid from the Visual Studio Designer

You can create a Grid element by editing XAML directly, but you can also create the Grid and set its properties from within the designer in Visual Studio.

Start by finding the Grid control in the toolbox.

Double-click the entry in the toolbox, or left-click and drag it onto your design surface, to create a Grid element.  You’ll see the Grid show up in XAML and in the designer.

You can add rows and columns from within the designer by clicking on an empty area of the blue borders at the top and left of the Grid.  Small blue arrows will indicate the rows/columns added.

You can change row/column sizes by dragging the blue arrows.  You can also change the GridUnitType of a row/column, dictating how it will calculate its size.

Everything that you do will also be reflected in the XAML.


#294 – Intellisense Is Also Available in the XAML Editor

In Visual Studio, Intellisense works in not only the code editor, but also the XAML editor.  As you being typing an element name, for example, Intellisense will display a window listing possible elements.

If you press TAB while an element is highlighted, Intellisense will insert the entire element name into the XAML.

As you continue typing, Intellisense will display a list of possible attributes that are appropriate for the current element.

Again, you can press TAB to insert the complete attribute name.  Intellisense will also add an equals (=) sign and a pair of quotation (“) marks.

Intellisense is also available when entering binding expressions.

#293 – Intellisense Will Show Overloaded Methods

Intellisense in Visual Studio presents you with a list of possible methods that you can call, based on what you’ve already typed.  If there are overloaded methods available in the current context, it will let you cycle through a list of the methods.  Overloaded methods are methods that have the same name, but a different argument list and/or return type.

In the example below, there are three different methods named Bark in the Dog class.  After you’ve entered the full method name and the opening parenthesis, Intellisense displays information about the first of the three methods.  The first overload of Bark takes a single int parameter.

If you press the down arrow key, or click on the downward facing arrow icon, Intellisense shows you the second of the three methods.

You can press the down arrow key again to see the third overload.

#292 – Intellisense Includes Information About a Method’s Parameters

Intellisense will display not only a list of methods that match what you’ve already typed, but will also show you information about the method’s parameters.

Assume that you begin entering the name of a method in the Dog class.  Intellisense shows you information about the  method.

If you now press the Tab key, Visual Studio will fill in the complete method name.

If you now enter an opening parenthesis, Intellisense will list the name of the Bark method again, with the first parameter in bold and a description of the first parameter.  (The method and parameter information will only be displayed if the class has defined the appropriate XML Documentation elements).


At this point, you can enter a value for the first parameter and then enter a comma.  Intellisense displays information about the second parameter.

#291 – Intellisense Lists Available Methods and Properties

When you type a period (.) after a variable that is a reference-typed variable, Intellisense in Visual Studio will display a list of relevant class members.

In the example below, the variable d is an instance of the Dog class.  When you enter a period (.) after the variable name, Intellisense displays a list of the members of the Dog class.  This includes both methods and properties.

You can use the arrow keys to select a specific class member.  As each class member is highlighted, information about the method or property is display to the right.

#290 – Using Intellisense in Visual Studio

Intellisense in Visual Studio is a feature that provides a list of suggested code elements that you might want to enter next, based on what you’ve already typed.

As you start typing, Intellisense will suggest  both language elements and types that match what you’ve already entered.

In the example below, I’ve entered the letter ‘w’ and Intellisense suggests some possible elements that begin with ‘w’ that I might want to enter.

If I’m actually entering a while statement, I can use the down arrow key to highlight while in the list and then press TAB.  Intellisense fills in the rest of the while keyword for me.

If I press TAB a second time, Visual Studio will actually generate a code snippet that is a template for the entire while statement.


Also notice that when Intellisense suggests a class name, it provides general information about the class.

#288 – Editing WPF Code-Behind in Visual Studio

WPF applications are made up of markup (XAML) and code-behind (managed code).  The markup defines the layout and appearance of the application, whereas the code-behind defines the behavior.

You use the code editor in Visual Studio to edit code-behind.

You can open the code editor in several different ways.

Double-click the code file from the Solution Explorer.  For C#, this is a .cs file.

Right-click a .xaml file and select View Code.

Right-click anywhere in the design view editor and select View Code.  You can do this either on the design surface or in the XAML editor.

You can also press the F7 key while you have a .xaml file open in the design view editor, or have a .xaml file selected in the Solution Explorer, to open the corresponding code-behind file in the code editor.

#286 – Adding Controls to a Window in Visual Studio by Editing XAML

You can add a WPF control to a window by using the design view editor in Visual Studio.  You add the control by dragging and dropping it onto a design surface.

You can also add a control by editing the XAML directly while in the design view editor in Visual Studio.

To open the design view editor for a particular window, double-click the associated .xaml file in the Solution Explorer.

The editor will show up as a split screen, with the design surface on the top and the XAML that defines the window contents below.

You can add a control by manually entering XAML in the lower window.  Here’s the XAML for a simple button.

As you enter XAML in the lower half of the editor, the design surface in the top half of the window will update to reflect the changes to the XAML.

Follow

Get every new post delivered to your Inbox.

Join 234 other followers