Select to view content in your preferred language

FeatureDataGrid Binding for formatting

2603
1
09-14-2011 11:37 AM
MichaelKohler
Frequent Contributor
I am trying to make an app to show redistricting plans. We will have several plans each with a FeatureLayer. I want to have a combo box switch between plans and change the FeatureDataGrid and a chart. I have been able to get this to work. However, the field names and content could use a little formatting. I haven't been able to get the http://forums.arcgis.com/threads/23731-Problem-with-Date-attribute-field.?highlight=featuredatagrid example from this thread to work. Not trying to change the layer the FeatureDataGrid is populated from at runtime with the combobox, I've just tried to get it to show formatted data for one of the layers. What happens is nothing shows up in the 4 columns I've defined and the data gets added in 4 more columns. so I have 8 columns and the first 4 are empty!

<esri:FeatureDataGrid x:Name="planDataGrid" Grid.Row="0" FontSize="8" Map="{Binding ElementName=MyMap}" AutoGenerateColumns="False"  GraphicsLayer="{Binding Layers[Plan 0], ElementName=MyMap}">
                        <esri:FeatureDataGrid.Columns>
                            <slData:DataGridTextColumn Binding="{Binding [DIST_NAME]}" Header="District"/>
                            <slData:DataGridTextColumn Binding="{Binding [P0010001], StringFormat=\{0:n0\}}" Header="Population"/>
                            <slData:DataGridTextColumn Binding="{Binding [DX_DEV], StringFormat=\{0:n0\}}" Header="Deviation"/>
                            <slData:DataGridTextColumn Binding="{Binding [P0010001_D], StringFormat=\{0:P2\}}" Header="% Deviation"/>
                        </esri:FeatureDataGrid.Columns>
                    </esri:FeatureDataGrid>
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
I understand this is an older thread but if you are still looking for answers, have you tried removing square brackets ([]) from the Attribute key? This was the only difference in the Binding syntax that I see from your post to the linked forum thread. Also, it might be helpful to include a converter for debugging purposes to see if it gets hit and what value you get when it does. Or if you have installed Silverlight 5, you can debug XAML binding 🙂
0 Kudos