Selecting an item works only once

7 posts, 0 answers
  1. Uwe Zimmermann
    Uwe Zimmermann avatar
    5 posts
    Member since:
    Oct 2009

    Posted 25 Nov 2010 Link to this post

    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?
  2. George
    Admin
    George avatar
    1332 posts

    Posted 30 Nov 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Uwe Zimmermann
    Uwe Zimmermann avatar
    5 posts
    Member since:
    Oct 2009

    Posted 01 Dec 2010 Link to this post

    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.
  5. George
    Admin
    George avatar
    1332 posts

    Posted 06 Dec 2010 Link to this post

    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
  6. Odd Veibust
    Odd Veibust avatar
    26 posts
    Member since:
    Feb 2007

    Posted 11 Oct 2011 Link to this post

    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.

  7. Odd Veibust
    Odd Veibust avatar
    26 posts
    Member since:
    Feb 2007

    Posted 12 Oct 2011 Link to this post

    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.
  8. Odd Veibust
    Odd Veibust avatar
    26 posts
    Member since:
    Feb 2007

    Posted 12 Oct 2011 Link to this post

    Nevermind. Someone had overridden the Equals method in the base class of the objects. It was never equal :/
Back to Top
UI for WPF is Visual Studio 2017 Ready