Skip to Content
.NET Windows Forms in a Nutshell
book

.NET Windows Forms in a Nutshell

by Ian Griffiths, Matthew Adams
March 2003
Intermediate to advanced
896 pages
32h 35m
English
O'Reilly Media, Inc.
Content preview from .NET Windows Forms in a Nutshell

Name

PropertyGrid

Synopsis

This Control will be very familiar to users of the Visual Studio .NET IDE, as it is used to provide the property inspector for objects in the designer. You can use it to provide a similar function in your own applications.

At its simplest, you can assign any object to the SelectedObject property, and it will use reflection to discover the properties and events in your object. You can also set an array of SelectedObjects. The grid will then display only those properties common to the entire array. This should not be confused with the SelectedGridItem property, which returns a GridItem representing the currently selected row in the grid. You can bind to the SelectedGridItemChanged event to receive notification when the selection is modified. As the values in the grid change, the PropertyValueChanged event is raised. If the SelectedObject (or SelectedObjects) changes, the grid will fire SelectedObjectsChanged.

Beyond that, you can use several designer attributes to mark up your target objects for use with the PropertyGrid, including System.ComponentModel.CategoryAttribute, which provides a means of visually grouping properties, and System.ComponentModel.DescriptionAttribute, which displays help text.

A property will appear in the grid unless it is annotated with No. You can customize this behavior by creating a new System.ComponentModel.AttributeCollection (passing an array of Attribute objects in the constructor) and assigning it to the grid’s BrowsableAttributes ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Windows Forms Programming in C#

Windows Forms Programming in C#

Chris Sells
C# 9.0 in a Nutshell

C# 9.0 in a Nutshell

Joseph Albahari

Publisher Resources

ISBN: 0596003382Catalog PageErrata