Data Display Issue: RadGridView Does not show data in bound ObservableCollection.

0 Answers 373 Views
GridView
Sean
Top achievements
Rank 1
Sean asked on 19 May 2022, 03:16 PM

I am sure that I am missing something basic here, but I cant get this control to behave. I tried a number of different things to get the data in the ObservableCollection to show up in the gridview with no luck.

(Using .netcore 3.0 libs)

The gridview is bound to the following property in the xaml .

                <telerik:RadGridView
                        VerticalAlignment="Top" 
                        x:Name="ProdRecordsGridView"
                        Grid.ColumnSpan="3" 
                        Grid.Row="1" 
                        AutoGenerateColumns="false"
                        ItemsSource="{Binding ProductionRecords}"
                        Margin="5"
                        SelectedItem="{Binding SelectedProductionRecord}">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn 
                            UniqueName="DatePartProduced"
                            DataMemberBinding="{Binding ProductionDate }"
                            IsFilterable="False"
                            DataFormatString="d"
                            EditTriggers="Default"
                            Header="ProdDate" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>

 

The ViewModel has the following Property

public ObservableCollection<ProductionRecordModel> ProductionRecords { get => _records; set => _records = value; } 

The grid control appears to be bound correctly to the ObserveableCollection, because setting a breakpoint on the ProductionRecordModel.ProductionDate getter, (the first column in the grid is bound to this property) is called for each element in the collection.  

There just does not appear to be any data in the gridview, I am stumped.

 

Any ideas what I am doing wrong here?

 

Thanks

-Sean

 

 

 

Martin Ivanov
Telerik team
commented on 20 May 2022, 12:15 PM

This happens because something is limiting the height of the parent panel that holds the RadGridView element. To resolve this, provide more height to the host panel that holds the GridView, the date pickers and the "Production Records" TextBlock.
Sean
Top achievements
Rank 1
commented on 20 May 2022, 01:19 PM

Thank you Martin, that was the issue exactly. I removed the hard coded height attributes from the parent and the grid view popped into existence like magic. Now I just need to figure out how to get a scroll bar to show up when the grid extends past the current window without having to hard code the height :-)

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Sean
Top achievements
Rank 1
Share this question
or