Appendix A. Common Properties

This appendix summarizes properties that are common to many WPF controls. See the earlier chapters and the following appendixes for more information about specific kinds of controls.

General Properties

Table A-1 summarizes general properties that apply to many controls. Note that not all properties apply to all control types.

Table A.1. General Properties

Property

Purpose

AcceptsReturn

Determines whether a [Return] character is inserted into a TextBox or RichTextBox, or whether a [Return] character in this control is ignored.

AcceptsTab

Determines whether a [Tab] character is inserted into a TextBox or RichTextBox, or whether a [Tab] character moves focus to the next control.

Background

The control's background color

BorderBrush

Determines the color of the control's border. Note that you must set BorderBrush to a visible color and BorderThickness to a value >0 before you can see the border.

BorderThickness

Determines the thickness of the control's border. Note that you must set BorderBrush to a visible color and BorderThickness to a value >0 before you can see the border.

Content

The content that the control should contain. Some controls (such as Button and Label) can hold only a single child as content, while others (such as Grid and StackPanel) can have many children. If a control can display text (such as a Button or Label), then you can set the Content property to a string for the control to display.

ContextMenu

The ContextMenu that the control should display when ...

Get WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.