I'm trying to display a lookupedit in a wpf grid and can't find an example.
My grid is bound to a BindingList<Customer> and each customer has a type that will be selected from a lookupedit.
The grid also has access to a BindingList<CustomerType> of all the available customer types.
public class CustomerType
{
public string Description { get; set; }
}
public class Customer
{
public CustomerType { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
I want to show the FirstName, LastName and the Description of the type as separate columns on the grid and have the user be able to choose the type from the lookupedit.
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.
Hi Dan,
Thank you for your question.
There is no necessity to use LookUpEdit in your case. To display a list of avaliable values in a drop down you can use the ComboBoxEditSettings. To accomplish your task just declare the CustomerClass column in the following manner:
<dxg:GridColumn FieldName="CustomerType"> <dxg:GridColumn.EditSettings> <dxe:ComboBoxEditSettings Name="CustomerTypeComboEditSettings" DisplayMember="Description" IsTextEditable="False" ItemsSource="{Binding AvaliableCustomerTypesList}" /> </dxg:GridColumn.EditSettings> </dxg:GridColumn>
The DisplayMemeber property specifies which member of CustomerType class to use as it's text representation. Also you'll need to set the ItemsSource as a list of avaliable customer types.
Please refer to the attachment for implementation details. Also see the Assigning Editors to Columns help topic for more information.
Thanks,
Dmitry
I need to use a lookup edit. The drop down needs to display multiple columns and sort on any of the displayed columns.
Hi Dan,
I miss the fact that there must be multiple columns in the CustomerType drop down. In this case it is necessary to use LookUpEdit, you are right. To make it, you can use the following xaml:
<dxg:GridColumn FieldName="CustomerType">
<dxg:GridColumn.EditSettings>
<dxg:LookUpEditSettings Name="CustomerTypeLookUp"
DisplayMember="Description"
IsTextEditable="False"
ItemsSource="{Binding AvaliableCustomerTypesList}"
PopupMinWidth="300"
/>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
I've modified the previous example to use a LookUpEdit. You can find it in the attachment.
Thanks,
Dmitry