Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > ComboBox > RadComboBox inside a GridView feeded by RadDomainDataSource

Not answered RadComboBox inside a GridView feeded by RadDomainDataSource

Feed from this thread
  • Michele avatar

    Posted on Jan 29, 2012 (permalink)

    Hello,
    I've two entities, Products and Categories, classically related as in the picture attached.
    In my XAML page, I've two controls feeding two different RadDomainDataSource, one for the Products and the other for the Categories coming from the RIA Services.

    I have to build a RadGridView which main ItemsSource is the RadDomain of the Products while in a column I would like to show a RadComboBox showing the current category and letting the user choose another one.

    The code is as follows.

    <Grid x:Name="LayoutRoot" Background="White">
        
    <telerik:RadDomainDataSource x:Name="ddsCategories" AutoLoad="true" PageSize="20" QueryName="GetCategories">
            <telerik:RadDomainDataSource.DomainContext><business:dsPuraMater></business:dsPuraMater></telerik:RadDomainDataSource.DomainContext>
        
    </telerik:RadDomainDataSource>         
        <telerik:RadDomainDataSource x:Name="ddsProdotti" AutoLoad="true" PageSize="20" QueryName="GetProducts">
           <telerik:RadDomainDataSource.DomainContext><business:dsPuraMater></business:dsPuraMater></telerik:RadDomainDataSource.DomainContext>         
        </telerik:RadDomainDataSource>         
        
        <
    telerik:RadGridView x:Name="grProducts" AutoGenerateColumns="False" CanUserFreezeColumns="False" HorizontalAlignment="Stretch"                                               
        IsBusy
    ="{Binding IsBusy, ElementName=ddsProdotti}" ItemsSource="{Binding DataView, ElementName=ddsProdotti}"
        RowDetailsVisibilityMode="VisibleWhenSelected" RowIndicatorVisibility="Collapsed" ShowGroupFooters="False" 
        ShowGroupPanel
    ="False" ShowInsertRow="True" VerticalAlignment="Stretch" telerik:StyleManager.Theme="Metro">
                <telerik:RadGridView.Columns>
                    
    <telerik:GridViewToggleRowDetailsColumn ExpandMode="Single" />
                    
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name, Mode=TwoWay}" Header="Nome" Width="200"></telerik:GridViewDataColumn>
                   <telerik:GridViewColumn Header="Category" Width="200"  >
                        
    <telerik:GridViewColumn.CellTemplate>
                            
    <DataTemplate>
                                
    <telerik:RadComboBox x:Name="myCombo"  Width="170" Height="20" telerik:StyleManager.Theme="Metro"
                                SelectedItem="{Binding Binding SelectedItem.Category}"
                               DisplayMemberPath="Name_IT"
                               ItemsSource="{Binding DataView, ElementName=ddsCategories}">
                                </telerik:RadComboBox>                         
                            </DataTemplate>                     
                        </telerik:GridViewColumn.CellTemplate>                 
                    </telerik:GridViewColumn>             
                
    </telerik:RadGridView.Columns>
            
    </telerik:RadGridView>     
    </Grid>

    Unfortunately, more than not to show the selected category of the item related to the particular row,
    the combobox has no items at all. Of course, I've modified the RIA service in the query GetCategories to Include() also the Products.
    And, if I try to fill the radcombobox outside the RadGridView (without Selecteditem part), the combo is filled
    in the right way.

    Where's the error?

    Thanks a lot.
    Attached files

    Reply

  • Konstantina Konstantina admin's avatar

    Posted on Feb 2, 2012 (permalink)

    Hello Michele,

    I think to make it work, you need to set the ElementName of the Binding of the ComboBox. For example:

    <telerik:RadComboBox x:Name="myCombo"  Width="170" Height="20" telerik:StyleManager.Theme="Metro"                            SelectedItem="{Binding ElementName=ddsProdotti, Path=SelectedItem.Category}"                            DisplayMemberPath="Name_IT"                            ItemsSource="{Binding DataView, ElementName=ddsCategories}">                             </telerik:RadComboBox>

    Also, you have to make sure that the items of the ComboBox are already loaded, before selecting the item.
    This is an issue with the ComboBox that if the items are loaded one by one and the first is not the one that needs to be selected, the ComboBox stops looking for the searched one.

    Hope this information helps.

    Kind regards,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Michele avatar

    Posted on Feb 2, 2012 (permalink)

    Dear Konstantina,
    thanks for your help but unfortunately setting the ElementName in the SelectedItem tag do not solve the problem.
    The fact is that the RadComboBox is completely void, with no items, even if I set the IsBusy property of the GridView containing the RadComboBox to False only after the complete loading of its DomainDataSource.

    Reply

  • Michele avatar

    Posted on Feb 2, 2012 (permalink)

    PS: With the same code outside the GridView (except for the SelectedItem that would have no sense there), the RadComboBox is filled in the right way.

    Reply

  • Michele avatar

    Posted on Feb 5, 2012 (permalink)

    Since it seems impossible to solve this problem, I will post it on another section...

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > ComboBox > RadComboBox inside a GridView feeded by RadDomainDataSource
Related resources for "RadComboBox inside a GridView feeded by RadDomainDataSource"

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