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

Trouble binding combobox

4 Answers 61 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Cheri
Top achievements
Rank 1
Cheri asked on 14 Mar 2012, 07:14 PM



Hello,

I am new to Silverlight and am trying to bind a combo box to a RadDomainDatasource.  I am following the example in the Documentation for RadComboBox, Binding to RIA Service.  I know the RadDomainDataSource is working but it doesn't seem to get linked to the ItemsSource property in the combo box (the combo box does not have any items in it).

I'm sure I am just overlooking something.  Any help would be appreciated.  Or if there is a sample project in the documentation, please send me a pointer.

Thanks,
Cheri

Here is my code snippet.  

   <UserControl.Resources>


            <telerik:RadDomainDataSource x:Key="dds" QueryName="GetOrganizations" AutoLoad="True">
            <telerik:RadDomainDataSource.DomainContext>
                <server:SSAssetsDomainContext />
            </telerik:RadDomainDataSource.DomainContext>
        </telerik:RadDomainDataSource>


        <DataTemplate x:Key="CustomItemTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding OrgID}"/>
                <TextBlock Text=" - "/>
                <TextBlock Text="{Binding LegalEntity}"/>
            </StackPanel>
        </DataTemplate>


        <DataTemplate x:Key="ComboBoxSimpleTemplate">
            <TextBlock Foreground="Red" Text="{Binding OrgID}" />
        </DataTemplate>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel Orientation="Vertical">
            <telerik:RadComboBox x:Name="radComboBox" Height="40" Width="120"
            ItemTemplate="{StaticResource CustomItemTemplate}"
            ItemsSource="{Binding Source={StaticResource dds}, Path=Description}"/>
        <Button Name="btn" Click="btn_Click" Content="Push" Width="200"/>
</StackPanel>
    </Grid>
</UserControl>

4 Answers, 1 is accepted

Sort by
0
Accepted
vk
Top achievements
Rank 1
answered on 15 Mar 2012, 09:19 AM
ItemsSource="{Binding Source={StaticResource dds}, Path=DataView}"
0
Cheri
Top achievements
Rank 1
answered on 15 Mar 2012, 12:50 PM

I tried these changes but received the same results... nothing in the list.
0
vk
Top achievements
Rank 1
answered on 15 Mar 2012, 01:59 PM
Sorry, I have corrected my previous post...
0
Cheri
Top achievements
Rank 1
answered on 15 Mar 2012, 02:02 PM


That did it!!  Thank you so much.
Tags
ComboBox
Asked by
Cheri
Top achievements
Rank 1
Answers by
vk
Top achievements
Rank 1
Cheri
Top achievements
Rank 1
Share this question
or