Select to view content in your preferred language

SpatialQueryAction & dataGrid

2302
27
06-21-2012 05:58 AM
MiriEshel
Esri Contributor
Hi,

Is there a way to show a DataGrid of the selected features using SpatialQueryAction.

There is a sample called: http://resourcesbeta.arcgis.com/en/help/silverlight-api/samples/start.htm#GraphicsActions
I want to extend this sample to show also the dataGrid of the selection's result.

Thanks a lot,
Miri
0 Kudos
27 Replies
MiriEshel
Esri Contributor
Hi Joe,

I would just like to ask you for your experience with your customDraggable Window:

1. When you resized the window and then minimized the window in you application - after that, when you maximized the window, did it return to the default value of the window or the last size before the minimize?

2. Did the "close button" close the window permanently?

Thanks a lot and Shabat Shalom,
Miri
0 Kudos
JoeHershman
MVP Alum
Miri,

  1. I pretty much always use the custom window as fixed size so I have not ever noticed that behavior.  I was looking at the code I wrote to see if I could figure out what is going on.  What I find especially strange is that it would return to the original Width since nothing it done with Width.  What I think needs to be done (have not had time to try) in the SetupMinimizeButton method the DoubleAnimation for both minimize and maximize is setup based on the Height, which would be the initial height.  What I am thinking is that instead of setting up the Maximize animation at startup it should be done when Minimize is called and the you could set the To = ActualHeight at the time Minimize is clicked

  2. I should not close it permanently I will take a closer look.  I use another class to manage the dialogs in the application, but from what I see it just changes IsOpen = true and the dialog reappears

Hope that helps and thank you
Thanks,
-Joe
0 Kudos
MiriEshel
Esri Contributor
Hi Joe,

Long time no hear....

I use your SpatialQueryAction.cs class in my project since it is more clear designwise (as you wrote).
I also decided to use the FloatingWindow from codeProject: http://www.codeproject.com/Articles/121488/FloatingWindow-Multi-windows-Interface-for-Silverl

The problem is, that the floating window uses FloatingWindowHost that is defined in MainPage.xaml.

How can I open the floating window at the end of the selection in SpatialQueryAction.cs if the host is in mainPage.xaml ?

Here is the code in MainPage.xaml:

  <CutsomWindow:FloatingWindowHost x:Name="host"  Grid.Row="2" Grid.Column="1"
           SnapinEnabled="True"
           SnapinDistance="3"
           SnapinMargin="10"
           ShowMinimizedOnlyInIconbar="False"
           >
  </CutsomWindow:FloatingWindowHost>

The floatingWindows does few things, among them:
          if (sqFW == null)
            {
                sqFW = new FloatingWindowQueryResult();
                sqFW.ResizeEnabled = true;
                sqFW.MapControl = Map;
                :
                :
                host.Add(sqFW);
                sqFW.Show(fwStartPoint);
             }

I hope I was clear ....

Thanks a lot,
Miri
0 Kudos
MiriEshel
Esri Contributor
Hi Joe,

I managed.
I defined another event in spatialQueryAction.cs.

This event is called from mainPage and is fired upon completion of the query.
Here is the code:
public event EventHandler PopUpFloatingWindow;

       public void OnQueryComplete()
        {
            if ( QueryComplete != null )
            {
                QueryComplete(this, EventArgs.Empty);
            }

            if (PopUpFloatingWindow != null)
            {
                PopUpFloatingWindow(null, null);
            }
        }

         <i:EventTrigger EventName="Click">
                                                <local:SpatialQueryAction x:Name="spatialQueryActionControl"
                                                OutFields="*"
                                                DrawMode="Rectangle"
                                                LayerID="SpatialQueryGraphicsLayer"
                                                Url="{Binding ElementName=selRectangle, Path=DataContext.URL}"                               
                                                Symbol="{Binding ElementName=selRectangle, Path=DataContext.SYMBOL}"
                                                TargetName="Map" PopUpFloatingWindow="spatialQueryActionControl_QueryComplete" />

Thanks a lot,
Miri
0 Kudos
JoeHershman
MVP Alum
Glad you came up with something.  My other thought was putting a DependencyProperty for FloatingWIndowHost to pass it into the Action.

Good Luck
Thanks,
-Joe
0 Kudos
MiriEshel
Esri Contributor
Hi Joe,

Thank you for the intensive help you've giving me so far. I appreciate it very much.

Could you elaborate on what you wrote about DependencyProperty for FloatingWIndowHost to pass it into the Action ?
It looks like I still need the DependencyProperty. I want to display a featureDataGrid in this window but it seems that it doesn't recognize the map (even without using the converter).

Can you take a look and tell me what I'm doing wrong?

The lines in mainPage.xaml are:

                            <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center"  Margin="2">
                                    <Button Tag="selRectangle" Name="selRectangle" ToolTipService.ToolTip="Select with a rectangle"
                                        IsEnabled="{Binding ElementName=selRectangle, Path=DataContext.Index, Converter={StaticResource CanBeSelectedConverter}}" Click="selRectangle_Click">
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                                <local:SpatialQueryAction x:Name="spatialQueryActionControl"
                                                OutFields="*"
                                                DrawMode="Rectangle"
                                                LayerID="SpatialQueryGraphicsLayer"
                                                Url="{Binding ElementName=selRectangle, Path=DataContext.URL}"                               
                                                Symbol="{Binding ElementName=selRectangle, Path=DataContext.SYMBOL}"
                                                TargetName="Map" PopUpFloatingWindow="spatialQueryActionControl_QueryComplete" />
                                          </i:EventTrigger>

The lines in mainPage.xaml.cs are:

           selRectangle.DataContext = _ActiveLayer;
            selPolygon.DataContext = _ActiveLayer;

and the floatingWindow and spatialQueryAction code are attached attached.


Thanks,
Miri
0 Kudos
JoeHershman
MVP Alum
This is along the lines of what I was thinking.  I have not tested it or anything so no guarantees.
Thanks,
-Joe
0 Kudos
MiriEshel
Esri Contributor
Ho Joe,

Thank you very much for your sample.

I've decided to stay with my original idea. It doesn't matter all that much as long as both ways do the job.

Thanks again,
Miri
0 Kudos