I have an
application (I’m using Silverlight,Prism,mvvm,wcf ria services,entity data
model).
In my Customer entity i have two properties
CountryID and CityID related Country and City Entities.
I get Countries with Cities by include
fromCustomerDomainService.
I try configure in my gridview relation with
Country and City radcomboboxes.
In detailview (in another view which is comboboxes
are not in gridview) i can bind the City radcombobox itemsource to Country
RadCombobox SelectedItem.Cities (ItemsSource="{Binding
SelectedItem.Cities, ElementName=CountryRadCombobox}"). But in gridview i
can't access the Country radcombobox.Because it is in data template. How can i
solve this problem.Thank you for your help..
5 Answers, 1 is accepted
You may review this blog post. There is an implementation of a common scenario when entering data is a cascade of combo boxes. The list in the next combo is populated after selecting a value in the previous - its ItemsSource depend on the SelectedItem of the second ComboBox.
Does this fits to your scenario?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
But i think i can solve this with custom filtering and sorting.
May be it is usefull for someone else looking for solution like this.
result seem like picture after.png :) I hope this helps. Here is code for RadGridView...
(
<telerik:RadGridView x:Name="RadGridViewCustomer"
IsFilteringAllowed="True"
ItemsSource="{Binding CustomersList, Mode=TwoWay}"
AutoGenerateColumns="False" Margin="10,35,10,5"
CanUserInsertRows="False"
CanUserDeleteRows="False"
AlternationCount="2"
SelectedItem="{Binding SelectedCustomer, Mode=TwoWay}"
RowDetailsVisibilityMode="VisibleWhenSelected" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn
DataMemberBinding="{Binding ID}"
Header="ID" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ID}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Name}"
Header="Name" IsFilterable="True">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Surname}"
IsFilterable="True"
Header="Surname">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Surname}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding Surname, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Phone}"
IsFilterable="True"
Header="Phone">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Phone}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding Phone, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn
DataMemberBinding="{Binding BirthDate}"
IsFilterable="True"
Header="BirthDate">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding BirthDate, StringFormat=\{0:d\}}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<telerik:RadDatePicker SelectedValue="{Binding BirthDate, Mode=TwoWay, StringFormat=\{0:d\}, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn
Header="Country - City">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<telerik:RadComboBox
MinWidth="80"
x:Name="CountryCombobox"
Style="{StaticResource RadComboBoxStyle1}"
IsFilteringEnabled="True"
CanAutocompleteSelectItems="True"
IsEditable="False"
EmptyText="Choose Country.."
Background="Transparent"
ClearSelectionButtonVisibility="Visible"
ClearSelectionButtonContent="Clear Selection.."
SelectedValue ="{Binding CountryID, Mode=TwoWay}"
ItemsSource="{Binding Country.CountriesList, Source={StaticResource Locator},UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="CountryName"
SelectedValuePath="ID"
/>
<telerik:RadComboBox
MinWidth="80"
Style="{StaticResource RadComboBoxStyle1}"
IsFilteringEnabled="True"
CanAutocompleteSelectItems="True"
IsEditable="False"
EmptyText="Choose City.."
Background="Transparent"
SelectedValue ="{Binding CityID, Mode=TwoWay}"
ItemsSource="{Binding SelectedItem.Cities, ElementName=CountryCombobox,Mode=OneTime}"
DisplayMemberPath="CityName"
SelectedValuePath="ID"
/>
</StackPanel>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<telerik:RadComboBox
MinWidth="80"
x:Name="CountryEditCombobox"
IsFilteringEnabled="True"
CanAutocompleteSelectItems="True"
IsEditable="False"
EmptyText="Choose Country.."
Background="Transparent"
ClearSelectionButtonVisibility="Visible"
ClearSelectionButtonContent="Clear Country.."
SelectedValue ="{Binding CountryID, Mode=TwoWay}"
ItemsSource="{Binding Country.CountriesList, Source={StaticResource Locator}}"
DisplayMemberPath="CountryName"
SelectedValuePath="ID"
/>
<telerik:RadComboBox
MinWidth="80"
IsFilteringEnabled="True"
Margin="5,0,0,0"
CanAutocompleteSelectItems="True"
IsEditable="False"
EmptyText="Choose City.."
Background="Transparent"
ClearSelectionButtonVisibility="Visible"
ClearSelectionButtonContent="Clear City.."
SelectedValue ="{Binding CityID, Mode=TwoWay}"
ItemsSource="{Binding SelectedItem.Cities, ElementName=CountryEditCombobox}"
DisplayMemberPath="CityName"
SelectedValuePath="ID"
/>
</StackPanel>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView> )
As I have understood you, your records are of type "AcquisitionStatus" and each record has a field AcquistionTypeID. Then you want the GridViewComboBoxColumn to show the AcquisitionTypes based on the AcquistionTypeID for the record. If this is the case then please try using ItemsSourceBinding instead of ItemsSource for binding the combobox column.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>