Ticket T813889
Visible to All Users

ListBoxEdit - A selected item is unselected when its internal DateEdit is edited

created 6 years ago (modified 6 years ago)

[DevExpress Support Team: CLONED FROM T813646: ListBoxEdit - How to horizontally stretch custom content from ItemTemplate]

Hello,
im customizing my item template like this

XAML
<dx:ListBoxEdit.ItemTemplate> <DataTemplate> <dxlc:LayoutGroup Orientation="Horizontal"> <dxlc:LayoutItem Label="{x:Static p:KundenResources.supplierGroup}"> <TextBlock Text="{Binding Lieferantengruppe}"/> </dxlc:LayoutItem> <dxlc:LayoutItem Label="bis"> <dx:DateEdit EditValue="{Binding bis}"/> </dxlc:LayoutItem> <dxlc:LayoutItem Label="eyo"> <dx:DateEdit EditValue="{Binding von}"/> </dxlc:LayoutItem> </dxlc:LayoutGroup> </DataTemplate> </dx:ListBoxEdit.ItemTemplate>

Additionally i just noticed that if an item is selected and i go from an empty dateedit to picking a date, the item is suddenly unselected.

Answers approved by DevExpress Support

created 6 years ago

Hello,
This behavior occurs because ListBoxEdit additionally handles the PropertyChanged event when you edit an item using DateEdit and refreshes items. To avoid this issue and achieve the same behavior as in the standard ListBox control, set ListBoxEdit's AllowLiveDataShaping property to "False":

XAML
<dxe:ListBoxEdit ItemsSource="{Binding Items}" HorizontalContentAlignment="Stretch" AllowLiveDataShaping="False"> <dxe:ListBoxEdit.ItemTemplate> <DataTemplate> <dxlc:LayoutControl> <dxlc:LayoutGroup Orientation="Horizontal"> <dxlc:LayoutItem Label="supplierGroup"> <TextBlock Text="{Binding Lieferantengruppe}" /> </dxlc:LayoutItem> <dxlc:LayoutItem Label="bis"> <dxe:DateEdit EditValue="{Binding bis}" /> </dxlc:LayoutItem> <dxlc:LayoutItem Label="eyo"> <dxe:DateEdit EditValue="{Binding von}" /> </dxlc:LayoutItem> </dxlc:LayoutGroup> </dxlc:LayoutControl> </DataTemplate> </dxe:ListBoxEdit.ItemTemplate> </dxe:ListBoxEdit>

Please try this approach and provide us with your results.

Thanks,
Kirill

    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.