Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ComboBox > Selecting an item works only once

Not answered Selecting an item works only once

Feed from this thread
  • Uwe Zimmermann avatar

    Posted on Nov 25, 2010 (permalink)

    Hallo,

    i have a problem with a RadComboBox. It's ItemsSource is an ObservableCollection<ThemeInfo>. The RadComboBox is a part of a RadRibbonBar. I bound my RibbonBarViewModel to the RadRibbonBar's DataContext property.

    Here is the xaml code for my RadComboBox:

    <telerik:RadComboBox
                                Name="themesRadComboBox"
                                Width="100" 
                                ItemsSource="{Binding ThemeInfos}"
                                SelectedItem="{Binding SelectedThemeInfo, Mode=TwoWay}"
                                Command="{Binding ChangeApplicationThemeCommand}"
                                DisplayMemberPath="DisplayName">
                            </telerik:RadComboBox>

    If i select an item it works fine, but if i do this the second time, DropDownList of RadComboBox stays closed. If the RadComboBox has focus and i use the arrow keys it also works as expected. Any ideas to solve this?

    Reply

  • George George admin's avatar

    Posted on Nov 30, 2010 (permalink)

    Hi Uwe,

    Thank you for contacting us.

    Could you please specify what version of our RadControls you use? Could you please try out latest Q3 binaries and let me know if issue is resolved.
    I tried to reproduce the problem, but to no avail. Could you please let me know if you can reproduce the problem with our online examples - http://demos.telerik.com/wpf/?ComboBox/FirstLook.

    Best wishes,
    George
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF

    Reply

  • Uwe Zimmermann avatar

    Posted on Dec 1, 2010 (permalink)

    Thanks for your answer, i tried out the latest binaries, but it's still the same. I think, the problem is my command binding. If i remove the declaration of the command binding from xaml, i can select like expected (but now without code execution at selection changed event). I'm new to WPF and MVVM and i would like to get an example how i can bind a command to a RadComboBox in my view model which will be executed if selection changed event fires. Thanks.

    Reply

  • George George admin's avatar

    Posted on Dec 6, 2010 (permalink)

    Hello,

    Attached you can find the sample using RadComboBox with MVVM pattern. I hope this helps.

    Please do not hesitate to contact us if you require any further information.


    All the best,
    George
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF

    Reply

  • Odd Veibust avatar

    Posted on Oct 11, 2011 (permalink)

    Hi.

    I see this is an old subject, but I am having the same problem now.

    When I bind the RadComboBox to an observablecollection, I can only select once. When I try to select another item, nothing happens. The ClearSelectionButton works, and after clearing I can select another item.
    <telerik:RadComboBox Grid.Column="0" Grid.Row="3" 
        Grid.ColumnSpan="2" x:Name="GearComboBox" 
        Margin="5,0,0,0" ClearSelectionButtonVisibility="Visible" 
        ClearSelectionButtonContent="Clear Selection" 
        ItemsSource="{Binding Source={StaticResource RegistersModelView}, Path=FishingGears}" 
        DisplayMemberPath="Code" />

    If I bind SelectedItem, it shows the right selecteditem, but I can not select another item. Here, the ClearSelectionButton is working, and I can after clicking it select a new item.
    <telerik:RadComboBox Grid.Column="0" Grid.Row="3"
        Grid.ColumnSpan="2" x:Name="GearComboBox"
        Margin="5,0,0,0" ClearSelectionButtonVisibility="Visible"
        ClearSelectionButtonContent="Clear Selection"
        ItemsSource="{Binding Source={StaticResource RegistersModelView}, Path=FishingGears}"
        SelectedItem="{Binding Path=RegistrationInformation.FishingGear, Mode=TwoWay}"
        DisplayMemberPath="Code" />

    I have both tried with DisplayMemberPath and an ItemTemplate, both have the same behaviour.

    If I add some RadComboBoxItems manually, instead of binding to a DataSource, everything works like a charm.
    <telerik:RadComboBox Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" x:Name="GearComboBox2" Margin="5,0,0,0" ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="Clear Selection">
        <telerik:RadComboBox.Items>
            <telerik:RadComboBoxItem>
                <telerik:RadComboBoxItem.Content>
                    <TextBlock Text="Item 1" />
                </telerik:RadComboBoxItem.Content>
            </telerik:RadComboBoxItem>
            <telerik:RadComboBoxItem>
                <telerik:RadComboBoxItem.Content>
                    <TextBlock Text="Item 2" />
                </telerik:RadComboBoxItem.Content>
            </telerik:RadComboBoxItem>
        </telerik:RadComboBox.Items>
    </telerik:RadComboBox>

    I'm using the latest binaries (downloaded today).

    Do you have any suggestions on what is causing the problem? Anything I need to be aware of in the ModelView? I see in your last post that you refer to an attached example, but it seems like the attachment is gone.

    Reply

  • Odd Veibust avatar

    Posted on Oct 12, 2011 (permalink)

    I now tried using a "normal" ComboBox, same problem there, so atleast it's not a problem with the RadComboBox. If you got any ideas, it would be helpful though.

    Reply

  • Odd Veibust avatar

    Posted on Oct 12, 2011 (permalink)

    Nevermind. Someone had overridden the Equals method in the base class of the objects. It was never equal :/

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ComboBox > Selecting an item works only once
Related resources for "Selecting an item works only once"

WPF ComboBox Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]