0
votes

I am using DevExpress WPF controls, expessicaly the BarEditItem, ComboBoxEdit and GridControl. Normally when you use the standard ComboBoxEdit, when you select an item, the combobox closed.

However, I am now setting the ComboBoxEditSettings.PopupContentTemplate to a GridControl. Whenever I select a row in the GridControl (by clicking on it), I want the dropdown to close. It works when I hit the key, but not when I simply click a record.

The XAML looks like this:

<dxb:BarEditItem.EditSettings >
                <dxe:ComboBoxEditSettings 
                    ItemsSource="{Binding Path=EditieCollection}"
                    DisplayMember="JaarEditieNummer"
                    AutoComplete="True"
                    Name="editieComboBox" AcceptsReturn="True" IncrementalFiltering="False" ImmediatePopup="True">
                    <dxe:ComboBoxEditSettings.PopupContentTemplate >
                        <ControlTemplate>
                            <dxg:GridControl 
                                Name="PART_GridControl" 
                                ItemsSource="{Binding Path=EditieCollection}" 
                                AutoPopulateColumns="False" ShowBorder="False"
                                >
                                <dxg:GridControl.Columns>
                                    <dxg:GridColumn x:Name="EditieJaarEditieNummer" FieldName="JaarEditieNummer" Header="Editie" Width="90" />
                                    <dxg:GridColumn x:Name="EditieOplage"  FieldName="OplageDatum" Header="Oplage" Width="90" />
                                    <dxg:GridColumn x:Name="EditieVerschijning"  FieldName="Datum" Header="Verschijnt" Width="90" />
                                    <dxg:GridColumn x:Name="EditieOmschrijving"  FieldName="Omschrijving" Header="Omschrijving" />
                                </dxg:GridControl.Columns>
                                <dxg:GridControl.View>
                                    <dxg:TableView 
                                        Width="Auto" 
                                        AllowGrouping="False" IsGroupPanelMenuEnabled="False" 
                                        FocusedRow="{Binding Path=SelectedEditie, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                        AllowEditing="False" AllowMoveColumnToDropArea="False" AllowMoving="False" 
                                        NavigationStyle="Row" ShowGroupPanel="False"
                                        />
                                </dxg:GridControl.View>
                            </dxg:GridControl>
                        </ControlTemplate>
                    </dxe:ComboBoxEditSettings.PopupContentTemplate>
                </dxe:ComboBoxEditSettings>
            </dxb:BarEditItem.EditSettings>

I have seen other solutions where one would set the .IsOpen property of the standard ComboBox control to false, but DevExpress ComboBoxEdit doesn't have that sort of property (at least not that I know of).

Thanks!

1

1 Answers

1
votes

I am now setting the ComboBoxEditSettings.PopupContentTemplate to a GridControl.

I believe the LookUpEdit instead of combobox is better choice for you in this case:

<dxb:BarEditItem Name="bEditItem" >
    <dxb:BarEditItem.EditSettings >
        <dxg:LookUpEditSettings ItemsSource="{Binding ...}"
                            DisplayMember="..." 
                            ValueMember="...">
        </dxg:LookUpEditSettings>
    </dxb:BarEditItem.EditSettings>
</dxb:BarEditItem>

Anyway, you can use the IsPopupOpen property to close popup window.