This is a migrated thread and some comments may be shown as answers.

RadComboBox trouble

1 Answer 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dejan
Top achievements
Rank 1
Dejan asked on 24 Mar 2011, 03:07 PM
Hi,

My name is Dejan and I'm new in Telerik/Silverlight environment, but not in programming. 

We just start new project, Silverlight app development using Telerik Silverlight Controls and I have really annoying problem with combo box. (maybe it's not big deal but I'm stacked).

Platform is: VS2010 + Silverlight4 + Telerik RadControls for Silverlight Q3 2010 SP1 + MSSQL 2008 

Scenario is next:

I have Entity with two fields: ID and Code. As you can see in code below I populate only "Code" field inside ComboBox List.
It is Entity with more then 5000 and growing items and I'm using VirtualizingStackPanel because.

I want to select "Code" as my choice inside ComboBox(IsEditable="True") but when I choose some "Code" value from the list only thing I'm getting in SelectionBox is "table name:ID" as SelectedItem, but if I change ComboBox(IsEditable="False") SelectionBox show me a "Code" I choose from the list.
In both cases (IsEditable = True or False), SelectedValue and SelectedItem have same value = "TableName : ID" but different result is shown in SelectionBox:

If  "IsEditable=True"  then SelectionBox = "TableName:ID
If "IsEditable=False" then SelectionBox = "Code"

And my ComboBox MUST be editable.
Why is that so and how to resolve this issue?

Best regards

Dejan  

My code is:
 
<Grid Height="57" HorizontalAlignment="Left" Margin="369,43,0,0" Name="gridSC" VerticalAlignment="Top" Width="420" DataContext="{Binding ElementName=supplier_codeDomainDataSource, Path=Data}">
            <telerik:RadComboBox  ItemsSource="{Binding ElementName=supplier_codeDomainDataSource,Path=Data}" HorizontalAlignment="Left" Margin="91,22,0,0" Name="cBoxSupplierCode" VerticalAlignment="Top" Width="250" IsEditable="True" SelectionChanged="cBoxSupplierCode_SelectionChanged" Text="{Binding Code}">
               <telerik:RadComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Width="300"/>
                    </ItemsPanelTemplate>
                </telerik:RadComboBox.ItemsPanel>
                <telerik:RadComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                           <telerik:RadComboBoxItem Content="{Binding Code}"/>
                        </StackPanel>
                    </DataTemplate>
                </telerik:RadComboBox.ItemTemplate>
            </telerik:RadComboBox>
            <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my1:View_Supplier_Code, CreateList=true}" Height="0" LoadedData="supplier_codeDomainDataSource_LoadedData" Name="supplier_codeDomainDataSource" QueryName="GetView_Supplier_CodeQuery" Width="0">
                <riaControls:DomainDataSource.DomainContext>
                    <my:ViewSupplier_codeDomainContext />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
        </Grid>

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantina
Telerik team
answered on 25 Mar 2011, 12:58 PM
Hello Dejan,

All you need to do is to the set the attached TextPath property of ComboBox like so:

telerik:TextSearch.TextPath="Name"

You can also check out this online demo for more information.

Kind regards,
Konstantina
the Telerik team
Tags
General Discussions
Asked by
Dejan
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Share this question
or