This question is locked. New answers and comments are not allowed.
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.
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.