Ticket T124399
Visible to All Users

Allow user input unlisted data comboboxeditsettings

created 11 years ago

I have a control which has  a comboBox and a button where users can select items from a list, but I want to let users write text. I have set theValidateOnTextInput to false but the problem is that when the control loses focus, the text I have introduced is eliminated. How could I accomplish this task? I have read that I can do it with the lookupedit control but I would like to use my control.

XAML
<dxg:GridColumn.EditSettings> <dxe:ComboBoxEditSettings ItemsSource="{Binding CarCollection}" DisplayMember="CAR_ID" ValueMember="CAR_ID" IsTextEditable="True" AllowNullInput="True" AutoComplete="True" ImmediatePopup="True" ValidateOnTextInput="False"> <dxe:ComboBoxEditSettings.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" MinWidth="90"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Text="{Binding CAR_ID}"/> <TextBlock Grid.Column="1" Text="{Binding CAR_DESCRIPTION}" Margin="15,0,0,0"/> </Grid> </DataTemplate> </dxe:ComboBoxEditSettings.ItemTemplate> <dxe:ComboBoxEditSettings.Buttons> <dxe:ButtonInfo GlyphKind="Regular" ClickMode="Release" Command="{Binding SelectCarCommand}"/> </dxe:ComboBoxEditSettings.Buttons> </dxe:ComboBoxEditSettings> </dxg:GridColumn.EditSettings>
Comments (2)
Andrey K (DevExpress Support) 11 years ago

    Hello Ander,

    Please clarify your ultimate goal. Do you wish to add new items in the CarCollection? If so, in which event handler do you wish to perform this? If you explain your scenario in greater detail, we will be able to find the most precise solution for you.

    Thanks,
    Andrew

      We want to manage a car garage for example. When adding new rows, we have to select the CAR_ID at first so  we have the following options:
      Option 1:
      The user introduces an existing CAR_ID and the combobox automatically gives him coincidences, the user can select one of them. This option is a must have. More or less it is working.
      Option 2:
      The user opens a window clicking a button an selects an option. This window is a must have and works well.
      Option 3:
      The user introduces a  CAR_ID that does not exist in the car collection and we want to save this new CAR_ID.
      Thank you,

      Answers approved by DevExpress Support

      created 11 years ago

      Hello Ander,
      Thank you for your clarification. To add a new item when it doesn't exist, handle the ProcessNewValue event.

      See also: Where is the ProcessNewValue event for ComboBoxEditSettings.AddNewButtonPlacement?

      Thanks,
      Alexander

        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.