This question is locked. New answers and comments are not allowed.
Hi, I'm trying to bind a RadGridView to a List(Of MyObject) where MyObject is a class with properties. When I set the ItemsSource on the Grid to my list, a row does get created however none of the data is in it. It doesn't look like it is getting to the properties in my object in order to display their values in the columns.
Grid:
Binding:
CostAndUtilizationSummaryMeasuresData:
CostAndUtilizationSummaryMeasuresDataViewModel:
The data IS being returned from the service, it just looks like the grid doesn't know how to associate the columns with the properties in my class.
Thank you in advance for any advice or help!
Grid:
<telerik:RadGridView x:Name="RadGridView1" Margin="0" RowIndicatorVisibility="Collapsed" IsReadOnly="True" Width="750" MinHeight="100" MaxHeight="200" AutoGenerateColumns="True" CanUserFreezeColumns="False" CanUserResizeColumns="False" Grid.Row="1"> <telerik:RadGridView.Columns> <telerik:GridViewImageColumn Header="Actual Encounters" DataMemberBinding="{Binding ActualEncounters}" /> <telerik:GridViewDataColumn Header="Peer Encounters" DataMemberBinding="{Binding PeerEncounters}" /> <telerik:GridViewDataColumn Header="Actual Cost/Episode" DataMemberBinding="{Binding ActualCostPerEpisode}" /> <telerik:GridViewDataColumn Header="Peer Cost/Episode" DataMemberBinding="{Binding PeerCostPerEpisode}" /> <telerik:GridViewDataColumn Header="Cost/Episode Index" DataMemberBinding="{Binding CostPerEpisodeIndex}" /> <telerik:GridViewDataColumn Header="Actual Total Cost" DataMemberBinding="{Binding ActualTotalCost}" /> </telerik:RadGridView.Columns> </telerik:RadGridView>Binding:
Private Sub GetCostAndUtilizationSummaryMeasuresForServiceCategoryCallback(ByVal sender As Object, ByVal e As ProviderService.GetCostAndUtilizationSummaryMeasuresForServiceCategoryCompletedEventArgs) Dim lRecord As Dictionary(Of String, String) = e.Result Dim lDatalist As New List(Of CostAndUtilizationSummaryMeasuresData) lDatalist.Add(New CostAndUtilizationSummaryMeasuresData(lRecord("ServiceCategory"), lRecord("ActualEncounters"), lRecord("PeerEncounters"), lRecord("ActualCostPerEpisode"), lRecord("PeerCostPerEpisode"), lRecord("CostPerEpisodeIndex"), lRecord("ActualTotalCost"))) Dim lModelList As New List(Of CostAndUtilizationSummaryMeasuresDataViewModel) For Each lDataItem As CostAndUtilizationSummaryMeasuresData In lDatalist lModelList.Add(New CostAndUtilizationSummaryMeasuresDataViewModel(lDataItem)) Next RadGridView1.ItemsSource = Nothing RadGridView1.ItemsSource = lModelList End SubCostAndUtilizationSummaryMeasuresData:
Public Class CostAndUtilizationSummaryMeasuresData Private ServiceCategory As String Private ActualEncounters As Integer Private PeerEncounters As Integer Private ActualCostPerEpisode As Decimal Private PeerCostPerEpisode As Decimal Private CostPerEpisodeIndex As Decimal Private ActualTotalCost As Decimal Public Sub New(ByVal pServiceCategory As String, ByVal pActualEncounters As Integer, ByVal pPeerEncounters As Integer, _ ByVal pActualCostPerEpisode As Decimal, _ ByVal pPeerCostPerEpisode As Decimal, _ ByVal pCostPerEpisodeIndex As Decimal, _ ByVal pActualTotalCost As Decimal) ServiceCategory = pServiceCategory ActualEncounters = pActualEncounters PeerEncounters = pPeerEncounters ActualCostPerEpisode = pActualCostPerEpisode PeerCostPerEpisode = pPeerCostPerEpisode CostPerEpisodeIndex = pCostPerEpisodeIndex ActualTotalCost = pActualTotalCost End Sub End ClassCostAndUtilizationSummaryMeasuresDataViewModel:
Public Class CostAndUtilizationSummaryMeasuresDataViewModel Private _data As CostAndUtilizationSummaryMeasuresData Public Sub New(data As CostAndUtilizationSummaryMeasuresData) Me._data = data End Sub Public ReadOnly Property Data() As CostAndUtilizationSummaryMeasuresData Get Return _data End Get End Property End ClassThe data IS being returned from the service, it just looks like the grid doesn't know how to associate the columns with the properties in my class.
Thank you in advance for any advice or help!
