Telerik RadComboBox not showing Selected Item

14,182

Are you somehow changing your collection? The controls only look for the items once. So, if the page loads and then you're loading your collection of RepTypes, it doesn't update the dictionary. I'm doing something similar and I'm lazy loading my collection (as you type, I get more from the database).

       <t:RadComboBox x:Name="RepTypeComboBox" Margin="0,1"
                   t:TextSearch.TextPath="TypeName"
                   ItemsSource="{Binding Path=RepTypes, Mode=OneWay}"
                   SelectedValue="{Binding Path=Reptype, Mode=TwoWay, NotifyOnValidationError=True}"                            
                   IsEditable="True" 
                   Grid.Column="1"
                   Grid.Row="2" TabIndex="1">
            <t:RadComboBox.ItemTemplate >
                <DataTemplate >
                  <StackPanel Orientation="Horizontal" >
                    <TextBlock FontWeight="Bold" Text="{Binding Path=TypeName, Mode=OneWay}" Width="75"/>
                        <TextBlock Text=": " />
                    <TextBlock Text="{Binding Path=address1, Mode=OneWay}" />
                        <TextBlock Text=" " />
                    <TextBlock Text="{Binding Path=address2, Mode=OneWay}" />
                        <TextBlock Text=" " />
                    <TextBlock Text="{Binding Path=citystate, Mode=OneWay}" />
                        <TextBlock Text=" " />
                    <TextBlock Text="{Binding Path=zip, Mode=OneWay}" />
                    </StackPanel>
                </DataTemplate>
            </t:RadComboBox.ItemTemplate>
        </t:RadComboBox>
Share:
14,182
Rico
Author by

Rico

Software and web developer for a Builder CRM system. But for side business I do small business development through IGOSB.com

Updated on June 04, 2022

Comments

  • Rico
    Rico almost 2 years

    I have a RadComboBox that i have bound like shown below

    <telerik1:RadComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,2" ItemsSource="{Binding RepTypes}" DisplayMemberPath="Path=TypeName"  SelectedValuePath="Value"  SelectedItem="{Binding RepType, Mode=TwoWay}" >
    
                        </telerik1:RadComboBox>
    

    When i select an Item I catch the Property Changed event, but basically the selection in the combo box stays blank.

    What am i doing wrong?

    Ok i made it so that it shows up now.. But i don't understand why... Or how to change it so it works for me in all cases...

               <telerik1:RadComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,2" ItemsSource="{Binding RepTypes}" SelectedValuePath="Value"  SelectedItem="{Binding RepType, Mode=TwoWay}"  >
    
                </telerik1:RadComboBox>
    

    Thats what works... the Biggest difference was. I had to name a field to "Name" and then bind it and take out the DisplayMemberPath="Path=ReportName"

    If that is the case then how do i tell the control what Field to Display in the dropdown?