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

Cascading Combo Boxes with a Static Resource

1 Answer 193 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 09 Feb 2016, 04:02 PM
`TelerikControls` has a bug and sometimes the `GridView` displays  empty `ComboBoxCells`. In order to fix this I followed their steps here http://docs.telerik.com/devtools/wpf/controls/radgridview/troubleshooting/blank-cells.html and I have to point the `ItemsSource` to a static resource. 

That method works perfectly if the resource never changes, but mine can change depending on a `ComboBoxSelection` within the `DataGrid`. I'm wondering how do I update my `StaticResource` collection in the UI.

I've tried this method http://stackoverflow.com/questions/4438876/wpf-refresh-staticresource but it never changed the collection in the UI. 

**RelationshipEditor.xaml.cs**

private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    var radcomboBox = e.OriginalSource as RadComboBox;
    if (radcomboBox != null)
    {
        RadComboBox comboBox = (RadComboBox)e.OriginalSource;
        (FindResource("MyChannelDataProvider") as ObjectDataProvider).Refresh();
    }
}`


**RelationshipEditor.xaml**

<ObjectDataProvider x:Key="MyChannelDataProvider" ObjectType="{x:Type Loans:LoanViewModel}">
 </ObjectDataProvider>
 
<Telerik:GridViewComboBoxColumn Header="Relationship"
                                ItemsSource="{Binding SelectedRelationship.GridRelationshipTypes, Source={StaticResource MyChannelDataProvider}}" 
                                DataMemberBinding="{Binding RelationshipType}"
                                SelectedValueMemberPath="Id"
                                DisplayMemberPath="Name">
</Telerik:GridViewComboBoxColumn>


I've set break points for `GridRelationshipTypes` and I can see it is getting the correct collection. If I remove static resource, the code works perfectly but it may still exhibit the telerik bug. 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 12 Feb 2016, 11:50 AM
Hello Minh,

I already replied you in the other forum thread you opened regarding this requirement. In order to avoid double posting, I would kindly ask you to continue any further communication regarding this topic in it.

All the best,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Minh
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or