# Creating Property Definitions | WPF Controls | DevExpress Documentation

The WPF Property Grid control uses [property definitions](/WPF/15521/controls-and-libraries/property-grid/property-definitions) to define how and which properties are displayed.

This document demonstrates how to bind the **WPF Property Grid** control to data and create property definitions.

Perform the following steps.

## Step 1 — Create a Property Grid

Add a [PropertyGridControl](/WPF/DevExpress.Xpf.PropertyGrid.PropertyGridControl) component to the project.

To do this, open the **Toolbox** in Visual Studio, locate the **DX.26.1: Data** tab, choose the **PropertyGridControl** Toolbox item, and drop it onto the window.

Right-click the Property Grid and select **Layout** | **Reset All** to fill the entire window.

![resetlayout_pg](/WPF/images/resetlayout_pg20667.png)

## Step 2 — Create a Data Object

Create a data object and set it as the DataContext.

- C#

<section id="tabpanel_O8jTPyD57q_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code class="lang-csharp">namespace Creating_Definitions {
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
            DataContext = new Customer() {
                ID = 1,
                FirstName = &quot;Nancy&quot;,
                LastName = &quot;Davolio&quot;,
                Gender = Gender.Female,
                BirthDate = new DateTime(1948, 8, 12),
                Phone = &quot;7138638137&quot;
            };
        }
        public class Customer {
            public int ID { get; set; }
            public string FirstName { get; set; }
            public string LastName { get; set; }
            public Gender Gender { get; set; }
            public DateTime BirthDate { get; set; }
            public string Phone { get; set; }
        }
        public enum Gender { Male, Female }
    }
}
</code></pre></section>

## Step 3 — Bind the Property Grid to the Data Object

Use the property grid’s [PropertyGridControl.SelectedObject](/WPF/DevExpress.Xpf.PropertyGrid.PropertyGridControl.SelectedObject) property to bind it to data.

- XAML

<section id="tabpanel_O8jTPyD57q-1_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;Window
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        xmlns:dxprg=&quot;http://schemas.devexpress.com/winfx/2008/xaml/propertygrid&quot; x:Class=&quot;PG_lesson1.MainWindow&quot;
        Title=&quot;MainWindow&quot; Height=&quot;250&quot; Width=&quot;525&quot;&gt;
    &lt;Grid&gt;

        &lt;dxprg:PropertyGridControl SelectedObject=&quot;{Binding}&quot; /&gt;

    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre></section>

## Step 4 — Create Property Definitions

Add property definitions to the property grid. Set the [PropertyGridControl.ShowProperties](/WPF/DevExpress.Xpf.PropertyGrid.PropertyGridControl.ShowProperties) property to [ShowPropertiesMode.WithPropertyDefinitions](/WPF/DevExpress.Xpf.PropertyGrid.ShowPropertiesMode), to hide the properties that do not have definitions.

- XAML

<section id="tabpanel_O8jTPyD57q-2_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;Window
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        xmlns:sys=&quot;clr-namespace:System;assembly=mscorlib&quot;
        xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
        xmlns:dxprg=&quot;http://schemas.devexpress.com/winfx/2008/xaml/propertygrid&quot; x:Class=&quot;PG_lesson1.MainWindow&quot;
        Title=&quot;MainWindow&quot; Height=&quot;250&quot; Width=&quot;525&quot;&gt;
    &lt;Grid&gt;

        &lt;dxprg:PropertyGridControl SelectedObject=&quot;{Binding}&quot; ShowProperties=&quot;WithPropertyDefinitions&quot; &gt;
            &lt;dxprg:PropertyDefinition Type=&quot;sys:String&quot; /&gt;
            &lt;dxprg:PropertyDefinition Path=&quot;Gender&quot; /&gt;
            &lt;dxprg:PropertyDefinition Path=&quot;BirthDate&quot; /&gt;
        &lt;/dxprg:PropertyGridControl&gt;

    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre></section>

Run the application to see the result.

![pg_simple](/WPF/images/pg_simple20698.png)