Select to view content in your preferred language

Feature DataForm - Need Help

1002
6
09-04-2012 08:32 AM
TanyaOwens
Frequent Contributor
Hi,

Is there a way to setup the fields in a Feature DataForm to do the following:

1. Clear existing text when the user clicks in the text box
2. block the user from editing certain fields
3. add a info description about what to type into each field.

Items 1 and 2 I really need to figure out, 3 is a "it would be nice" function but not critical.

Please help, I can't figure this out. I am using API 2.4 and SL4.

Thanks!
0 Kudos
6 Replies
TanyaOwens
Frequent Contributor
Has anyone been successful in doing this?
0 Kudos
TanyaOwens
Frequent Contributor
Update:

I was able to find a work around for #2 - I set the field to read only in arcmap and republished the service which now blocks that field from being edited.

:confused: I still am stuck on how to make the fields clear when the user clicks into the test box to edit the data. Does anyone know how to do this? Any help would be greatly appreciated.

Thanks!
0 Kudos
TanyaOwens
Frequent Contributor
So I have been playing with some code to try to clear the text in the Feature DataForm when the user clicks in the textbox to enter their information. The following code gives me the dreaded NullReference Exception Error at the "txb.Text = String.Empty;" line. Any help would greatly appreciated.

Error:
System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  StackTrace:
       at BikeCountSignUpWebApp.MainPage.MyFeatureDataForm_GotFocus(Object sender, RoutedEventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
  InnerException:

Xaml:
                        <Border x:Name="FeatureDataFormBorder" 
        Visibility="Visible" 
        HorizontalAlignment="Center" 
        VerticalAlignment="Top" 
        Margin="10,0,10,0" 
        Width="400" Height="300" >

                            <Border.Effect>
                                <DropShadowEffect Color="#FF51626F" Direction="-45" BlurRadius="20" Opacity=".75" />
                            </Border.Effect>

                            <esri:FeatureDataForm x:Name="MyFeatureDataForm"   
         FeatureLayer="{Binding Path=Layers[AllAvailableFeatureLayer], ElementName=Map}" 
         IsEnabled="True"
                                    GotFocus="MyFeatureDataForm_GotFocus"
                                    DataContext="{Binding}"
               IsReadOnly="False" 
         LabelPosition="Left"
         CommitButtonContent="Save" 
         EditEnded="MyFeatureDataForm_EditEnded"/>
                        </Border>


c#:
        private void MyFeatureDataForm_GotFocus(object sender, RoutedEventArgs e)
        {
            
            TextBox txb = sender as TextBox; 
            txb.Text = String.Empty;
            
        }
0 Kudos
ChristopherHill
Deactivated User
If you want to change the default functionality you will have to download the toolkit and make the change inside the FeatureDataFrom. The entire toolkit is open source on CodePlex
0 Kudos
TanyaOwens
Frequent Contributor
If you want to change the default functionality you will have to download the toolkit and make the change inside the FeatureDataFrom. The entire toolkit is open source on CodePlex


:confused: I think that my be a bit out of my current skill level. I am very, very new to programming. Are you saying to make changes in the references themselves? I am not sure what kind of changed to make to allow for the functionality I am looking for.

I downloaded the toolkit and have two dll files and two xml files. Is there any guidance/examples/tutorials on making changes to  this? And would I replace these modified files with the for the current reference files?
0 Kudos
ChristopherHill
Deactivated User
Yes, you are modifying the FeatureDataForm control and compiling it yourself then replacing your reference to ESRI.ArcGIS.Toolkit.dll with the modified ESRI.ArcGIS.Toolkit.dll.
0 Kudos