Cannot set style for FeatureDataForm built inside of EditorWiget

649
5
11-04-2010 09:21 AM
XiujuZhou
New Contributor III
I have set style for FeatureDataForm control. but failed to apply the FeatureDataForm for EditorWiget. in another word, EditorWiget still uses its own. Also I cannot set style for the Data Form which is built inside of EditorWiget such as for draw new graphic and for DisplayAttribute button. Please help!
0 Kudos
5 Replies
JenniferNery
Esri Regular Contributor
The FeatureDataForm displayed by the EditorWidget cannot be styled at the moment.  If you wish to use your own customized FeatureDataForm, you will need to customize the EditorWidget default style to replace the DisplayAttribute button with your own button that will display your own FeatureDataForm instance.

You can refer to this sample on how to update the properties for the FeatureDataForm: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataForm
0 Kudos
XiujuZhou
New Contributor III
Thanks Jannier. I got your good ideas. one more left is how to replace data form of adding new feature with my own FeatureDataForm?

The FeatureDataForm displayed by the EditorWidget cannot be styled at the moment.  If you wish to use your own customized FeatureDataForm, you will need to customize the EditorWidget default style to replace the DisplayAttribute button with your own button that will display your own FeatureDataForm instance.

You can refer to this sample on how to update the properties for the FeatureDataForm: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataForm
0 Kudos
JenniferNery
Esri Regular Contributor
If you will be using your own FeatureDataForm instance, then you can set ShowAttributesOnAdd to false.  Subscribe to the TemplatePicker's Editor's EditCompleted event where EditAction is Add. The EditEventArgs contain the graphic and layer, which you can use to set FeatureDataForm's FeatureLayer and GraphicSource properties. To retrieve this Editor, you can get the default style for the EditorWidget using ExpressionBlend and do a FindName() on the template to get the TemplatePicker, get its DataContext as Editor.
0 Kudos
AliMirzabeigi
New Contributor
You can also use a simpler approach and define implicit styles for TextBlock, TextBox, DatePicker, ComboBox, and Button controls in the App.XAML of your Silverlight application. Even though the EditorWidget control does not have a Style property for its internal FeatureDataForm control the implicit styles will automatically apply to the contents of your data form and you won't need to go through the process of replacing existing buttons, handling events, styling your own FDF, etc...

Hope this helps.
0 Kudos
JenniferNery
Esri Regular Contributor
Correction to my previous post. If you set an implicit FeatureDataFormStyle at the Application.Resources level, EditorWidget will use this style on FeatureDataForm when displaying attributes. It is only when the style is defined in UserControl or Grid that contained EditorWidget that this implicit style is not used.
0 Kudos