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

Nested Properties needs Dictionary<> support

1 Answer 110 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 2
Shawn asked on 22 Oct 2018, 06:27 PM

I would hope that a Xamarin.Forms component would support all forms of data binding that Xamarin.Forms itself supports.  I do not think that is the case.  Most mature data binding systems, like Xamarin.Forms, support binding to items within a Dictionary.  So if I have a Dictionary<string,double> called Data within my row datamodel, I should be able to create a column with a property name of "Data[Oil]" which should grab the double out of the Data Dictionary with key of "Oil".  I do not think this is supported as I get blank cells when I try it.

 

Does this actually work and I am missing something?

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 25 Oct 2018, 12:05 PM
Hello Shawn,

I am afraid the described scenario with a Dictionary binding is not supported with the built-in DataGrid columns. In short, RadDataGrid could not visualize properties of type IEnumarable such as Dictionary, List, and other. So, in the concrete case, you would need to usе DataGridTemplateColumn and handle the binding inside the CellContentTemplate.  Here is a quick example:

<telerikDataGrid:DataGridTemplateColumn>
    <telerikDataGrid:DataGridTemplateColumn.CellContentTemplate>
        <DataTemplate>
            <Label Text="{Binding Data[Oil]}"/>
        </DataTemplate>
    </telerikDataGrid:DataGridTemplateColumn.CellContentTemplate>
</telerikDataGrid:DataGridTemplateColumn>

I hope such an approach would be acceptable for you.

Regards,
Yana
Progress 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
DataGrid
Asked by
Shawn
Top achievements
Rank 2
Answers by
Yana
Telerik team
Share this question
or