Select to view content in your preferred language

Feature Data Grid Editing

2034
6
Jump to solution
01-18-2012 06:53 AM
DavidAshton
Frequent Contributor
I was looking into using the editing option with the feature data grid - SDK exmaple: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataGrid

I want to add this to an existing project and my question revolves around the fact that I'm using a feature data grid that was built from a previous api before the editing option was add.  So I don't see the commit button on my feature data grid. 

I've upgraded my app to API 2.3 and I've tweak my feature data grid (I've add some custom buttons and a personal look) so in my code my feature data grid is referencing a custom style/resource

Style="{StaticResource FeatureDataGridStyle1}"


I can add a commit button but I don't know what code to add to commit the edits (I can add a click event).  Can ESRI/Someone give me that code?  OR should I wipe out my custom style resource and see if the commit button shows up and then re-add all my customization?

Thanks
Dave
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
It's managed by 'TemplatePart' so you can just create a button in your FeatureDataGridGrid template having the name 'SubmitChangesMenuButton' and the appropriate code will be executed when the user clicks the button (you don't need to worry about the code)

For infos, the template parts defined for the FeatureDataGrid are:

[TemplatePart(Name = "MoveFirstButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "MovePreviousButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "CurrentRecordNumberTextBox", Type = typeof(TextBox))]
[TemplatePart(Name = "MoveNextButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "MoveLastButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "NumberOfRecordsTextBlock", Type = typeof(TextBlock))]
[TemplatePart(Name = "PopupMenu", Type = typeof(Popup))]
[TemplatePart(Name = "OptionsButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "ClearSelectionMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "SwitchSelectionMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "SelectAllMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "ZoomToSelectionMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "DeleteSelectedRowsMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "SubmitChangesMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "AutoChangeMapExtentCheckBox", Type = typeof(ToggleButton))]

View solution in original post

0 Kudos
6 Replies
DavidAshton
Frequent Contributor
I was binding my feature grid to a graphic layer and not a feature layer.  Once I pointed it to a feature layer it showed up.  I guess my new thought is can I work the feature data grid with several feature layers and a graphic layer...Depending on what one is populated the grid then the commit button would show.

Something like: 

GraphicsLayer="{Binding Layers[FeatureLINES; FeaturePOINTS; SelectGraphicLayer], ElementName=Map}"


It seems like that should be right but it doesn't work; can bind two different featurelayers or graphcic layers ?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
It's managed by 'TemplatePart' so you can just create a button in your FeatureDataGridGrid template having the name 'SubmitChangesMenuButton' and the appropriate code will be executed when the user clicks the button (you don't need to worry about the code)

For infos, the template parts defined for the FeatureDataGrid are:

[TemplatePart(Name = "MoveFirstButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "MovePreviousButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "CurrentRecordNumberTextBox", Type = typeof(TextBox))]
[TemplatePart(Name = "MoveNextButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "MoveLastButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "NumberOfRecordsTextBlock", Type = typeof(TextBlock))]
[TemplatePart(Name = "PopupMenu", Type = typeof(Popup))]
[TemplatePart(Name = "OptionsButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "ClearSelectionMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "SwitchSelectionMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "SelectAllMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "ZoomToSelectionMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "DeleteSelectedRowsMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "SubmitChangesMenuButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "AutoChangeMapExtentCheckBox", Type = typeof(ToggleButton))]
0 Kudos
DavidAshton
Frequent Contributor
Cool thanks for the response Dominique,

Can you take a look at my other question about binding two layer or more...is this possible?

Thanks
again
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The FeatureDataGrid supports only one GraphicsLayer (otherwise the problem would be to merge the comlumns of different layers).

So you can NOT set the GraphicsLayer property to a list of layers but you can change it at run time if you need (but only one at a time).
0 Kudos
DavidAshton
Frequent Contributor
Dominique,

Thanks for the reply! 


you can change it at run time if you need (but only one at a time).



At first I was thinking I could just create a text parameter and then set the active layer name to the text in the code behind...after the user creates a selection on the active layer.  So my xaml would look like:

 <TextBlock x:Name="PathLayer" Text="" Visibility="Collapsed" FontWeight="Bold" Foreground="WHITE" FontSize="10" VerticalAlignment="Center" />


                            <esri:FeatureDataGrid Grid.Row="1" x:Name="FeatureDataGrid" Height="170" 
                                      Map="{Binding ElementName=Map}"  
                        
                                GraphicsLayer="{Binding Text, ElementName=PathLayer, Mode=OneWay}" Style="{StaticResource FeatureDataGridStyle1}"/>




But that isn't working for some reason so should I approach this differently?

Thanks
0 Kudos
DominiqueBroux
Esri Frequent Contributor
GraphicsLayer property is of type GraphicsLayer and you are trying to bind to a string. So that can't work.

For test purpose, you could just try to set the GraphicsLayer property by code when your active layer changes (MyFeatureDataGrid.GraphicsLayer = MyActiveLayer; )

Then if you want to clean up your code, you will probably need to create an ActiveLayer property in your view model and bind it to the GraphicsLayer property of the FeatureDataGrid.
0 Kudos