Ticket T312583
Visible to All Users

How to define a custom property editor's settings based on the current object in a ListView

created 9 years ago

Hi, I need to create a custom string property editor with predefined values generated based on some properties of the current object.
I used this example https://documentation.devexpress.com/#eXpressAppFramework/CustomDocument113101
and everything works fine in DetailView.
But in editable ListView SetupRepositoryItem is called only once and CurrentObject is null. So predefinedValues is empty.
I have read that I can assing different repositoryItem to different cells in GridView https://documentation.devexpress.com/#windowsforms/CustomDocument3020
But how can accomplish this task on property editor level?

Answers approved by DevExpress Support

created 9 years ago (modified 3 years ago)

Hello Ivan,

The easiest way is to use a ViewController that customizes cell editors, for example, by handling the GridView.CustomRowCellEdit or GridView.ShownEditor method. You can also use the ColumnView.CustomColumnDisplayText event to customize the text displayed when a cell editor is inactive. Refer to the Access Grid Control Properties topic for additional information.

To accomplish this task without a controller, perform the following steps:

1. Create a custom editor control and a custom RepositoryItem for it, e.g., ComboBoxEdit and RepositoryItemComboBox descendants - see Custom Editors.
2. Implement the IGridInplaceEdit interface in the custom control (ComboBoxEdit descendant).
3. Refresh predefined items based on the received object in the IGridInplaceEdit.GridEditingObject property setter.

See also: The underlying control of a custom PropertyEditor should support the IGridInplaceEdit interface for complex in-place editing scenarios (e.g., data source filtering) in WinForms

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.