Back to Devexpress

CellEditorPresenter.PathMode Property

wpf-devexpress-dot-xpf-dot-propertygrid-dot-celleditorpresenter-52601786.md

latest4.7 KB
Original Source

CellEditorPresenter.PathMode Property

Specifies whether the CellEditorPresenter.Path property represents an absolute path or a path relative to the parent PropertyDefinition. This is a dependency property.

Namespace : DevExpress.Xpf.PropertyGrid

Assembly : DevExpress.Xpf.PropertyGrid.v25.2.dll

NuGet Package : DevExpress.Wpf.PropertyGrid

Declaration

csharp
public CellEditorPresenterPathMode PathMode { get; set; }
vb
Public Property PathMode As CellEditorPresenterPathMode

Property Value

TypeDescription
CellEditorPresenterPathMode

A CellEditorPresenterPathMode enumeration value that specifies whether the CellEditorPresenter.Path property represents a relative path or an absolute path. The default is CellEditorPresenterPathMode.Relative.

|

Available values:

NameDescription
Absolute

The CellEditorPresenter.Path points to a property of the PropertyGridControl.SelectedObject.

| | Relative |

The CellEditorPresenter.Path points to a property of an object associated with the parent PropertyDefinition.

|

Remarks

Use the PathMode property to specify whether the CellEditorPresenter.Path property represents a relative path or an absolute path.

Relative path points to a property of an object associated with the parent PropertyDefinition.

Absolute path points to a property of the PropertyGridControl.SelectedObject.

The following example demonstrates the difference between absolute and relative property paths.

xaml
<dxprg:PropertyGridControl SelectedObject="{Binding Person}" ShowProperties="WithPropertyDefinitions">
    <dxprg:PropertyGridControl.PropertyDefinitions>
        <dxprg:PropertyDefinition Path="Address" Header="Contact">
            <dxprg:PropertyDefinition.ContentTemplate>
                <DataTemplate>
                    <StackPanel>
                        <!-- Links to Person.Address.AddressLine1-->
                        <dxprg:CellEditorPresenter Path="AddressLine1"/>
                        <!-- Links to Person.Address.AddressLine2-->
                        <dxprg:CellEditorPresenter Path="AddressLine2"/>
                        <!-- Links to Person.Phone-->
                        <dxprg:CellEditorPresenter Path="Phone" PathMode="Absolute"/>
                    </StackPanel>
                </DataTemplate>
            </dxprg:PropertyDefinition.ContentTemplate>
        </dxprg:PropertyDefinition>
    </dxprg:PropertyGridControl.PropertyDefinitions>
</dxprg:PropertyGridControl>
csharp
public class Person {
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public Address Address { get; set; }
    public string Phone { get; set; }
}
public class Address {
    public string AddressLine1 { get; set; }
    public string AddressLine2 { get; set; }
}
csharp
public class ViewModel {
    public Person Person { get; set; }
    public ViewModel() {
        Person = new Person {
            FirstName = "Anita",
            LastName = "Benson",
            Address = new Address {
                AddressLine1 = "9602 South Main",
                AddressLine2 = "Seattle, 77025, USA",
            },
            Phone = "7138638137",
        };
    }
}

See Also

Path

CellEditorPresenter Class

CellEditorPresenter Members

DevExpress.Xpf.PropertyGrid Namespace