|
POST
|
You can do something like this: query.Where("not fieldname is null");
... View more
10-06-2010
03:33 PM
|
0
|
0
|
333
|
|
POST
|
Actually I don't know what your GraphicsLayer is used for. Are you referring to an SDK sample? If your GraphicsLayer will update its Graphics based on the result of the query, then having an instance of GraphicCollection is not necessary. You can update your ItemsSource binding to:
<slData:DataGrid x:Name="QueryDetailsDataGrid" ItemsSource="{Binding ElementName=MyMap, Path=Layers[MyGraphicsLayer].Graphics>
Note that the graphics contained in your GraphicsLayer should also include the attributes for your DataGrid.Columns binding to work. You might need something like:
graphicsLayer.Graphics.Clear();
foreach(Graphic g in featureSet.Features)
{
Graphic graphic = new Graphic(){Geometry = g.Geometry};
foreach(var item in g.Attributes)
graphic.Attributes.Add(item.Key, item.Value);
graphicsLayer.Graphics.Add(graphic);
}
... View more
10-06-2010
02:53 PM
|
0
|
0
|
1134
|
|
POST
|
There is a CancelActive command in the Editor that will let you do the following:
if (MyEditor.CancelActive.CanExecute(null))
MyEditor.CancelActive.Execute(null);
I'm not sure if this is sufficient for your use case, but this lets you cancel the active command (i.e. EditVertices, Select, etc.). If you need to perform check on the graphic before EditVertices command is activated, you can activate EditVertices in code-behind instead.
private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
{
bool canEdit = IsEditAllowed(e.Graphic);
if (canEdit && MyEditor.EditVertices.CanExecute(e.Graphic))
MyEditor.EditVertices.Execute(e.Graphic);
}
... View more
10-06-2010
02:35 PM
|
0
|
0
|
1070
|
|
POST
|
The key here is to assign the DataGrid's ItemsSource once through Binding to an instance of your ObservableCollection and manipulate this collection instead of re-assigning the DataGrid's ItemsSource because that will defeat the purpose of Binding. In your XAML, you can create an instance of your PipeGrid or simply use esri's GraphicCollection.
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources>
<esri:GraphicCollection x:Key="MyGraphicCollection"/>
</Grid.Resources>
<!-- more code goes here -->
<slData:DataGrid x:Name="QueryDetailsDataGrid" ItemsSource="{Binding Source={StaticResource MyGraphicCollection}}"
<!-- more code goes here -->
In the code-behind, you can grab the instance of your ObservableCollection and update them after the query has completed.
public MainPage()
{
InitializeComponent();
myGraphics = this.LayoutRoot.Resources["MyGraphicCollection"] as GraphicCollection;
}
GraphicCollection myGraphics;
void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
FeatureSet featureSet = args.FeatureSet;
if (featureSet != null && featureSet.Features.Count > 0)
{
if (myGraphics != null)
{
myGraphics.Clear();
foreach (Graphic g in featureSet.Features)
myGraphics.Add(g);
}
}
}
This way anytime you remove a graphic from myGraphics, the DataGrid updates itself.
... View more
10-06-2010
12:20 PM
|
0
|
0
|
1134
|
|
POST
|
It is actually very difficult to know where your app can be failing because I do not know the actual program flow. I would suggest putting a breakpoint to where you set _Map, if this code is not hit, then maybe SetMap is not called or the parameter, TheMap, is null.
... View more
10-05-2010
10:26 AM
|
0
|
0
|
1549
|
|
POST
|
It seems the attached file is corrupted because of the file size. In case there's no need for me to check your EditorWidgetStyle, you can use the new button's event handler to access the selected graphics. You can try this first and see if this works for you. If not, you can try to send your attachment again. But before you submit, can you do a preview post and check if the attachment can be unzipped? Thanks.
... View more
10-05-2010
10:23 AM
|
0
|
0
|
1138
|
|
POST
|
Oh so MyMap belongs to MainPage.xaml but you need to update it's properties in WindowPanel.xaml. Does WindowPanel contain MainPage? If yes, you probably have something like:
<local:MainPage x:Name="MainPage"/>
Provide this instance a name so you can access MyMap by using this.MainPage.MyMap...
... View more
10-05-2010
10:09 AM
|
0
|
0
|
776
|
|
POST
|
Hi. Do you mind uploading a new zipped file? I was not able to open this attachment. To answer your other question: You can access selected features by doing the following:
FeatureLayer layer = this.MyMap.Layers["LayerID"] as FeatureLayer;
if (layer != null)
foreach(Graphic g in layer.SelectedGraphics)
{
// Do what you need to do with each selected graphic.
}
Another way to find out if there are new selection in the layer is to subscribe to PropertyChanged event of that layer where e.PropertyName == "SelectedGraphics" (or "SelectionCount" - either one is fine). You can get look at SelectedGraphics or Graphics where graphic.Selected is true.
... View more
10-05-2010
09:36 AM
|
0
|
0
|
1138
|
|
POST
|
"MyMap" in the code I posted is the name of the map from the sample. You might have renamed the map to something else, you should use that name instead.
... View more
10-05-2010
09:25 AM
|
0
|
0
|
776
|
|
POST
|
Kindly check this related post: http://forums.arcgis.com/threads/10588-Silverlight-control-and-Google-maps
... View more
10-05-2010
09:14 AM
|
0
|
0
|
390
|
|
POST
|
Are you referring to samples from: http://esriurl.com/slsdk2 ? Which sample? Thanks.
... View more
10-05-2010
09:03 AM
|
0
|
0
|
535
|
|
POST
|
If you need to set the map's Visibility property, you can do the following (just as you would with any other UIElement)
this.MyMap.Visibility = System.Windows.Visibility.Collapsed;
where MyMap is the name of the map. If you need a specific layer on your map to set it's Visible property, you can do the following:
this.MyMap.Layers["StreetMap"].Visible = false;
where "StreetMap" is the ID of the Layer that you need affected.
... View more
10-05-2010
09:00 AM
|
0
|
0
|
1549
|
|
POST
|
It sounds like you won't need to add an extra button if all the new button is doing is access the selected features returned using select tool. What you can do instead is subscribe to the EditCompleted event of the EditorWidget's Editor so that you will not require an additional button click.
public MainPage()
{
InitializeComponent();
Editor editor = this.MyEditorWidget.DataContext as Editor;
if (editor != null)
editor.EditCompleted += editor_EditCompleted;
}
void editor_EditCompleted(object sender, Editor.EditEventArgs e)
{
if (e.Action == Editor.EditAction.Select)
{
foreach (var edit in e.Edits)
{
// Do what you need to do with edit.Graphic
// (edit.Layer as FeatureLayer).SelectedGraphics also
// gives you a list of all selected graphics in the specific layer
}
}
}
If you still wish to add buttons to the EditorWidget, you can modify the DefaultTemplate. It can be done using Expression Blend.This post is related and you might want to check it out: http://forums.arcgis.com/threads/9756-Undo-edits-of-the-EditorWidget You can add something like this to your EditorWidgetStyle: XAML-code:
<Button x:Name="MyButton" IsEnabled="True" Style="{StaticResource ButtonStyle}" Content="My New Button" Click="MyButton_Click" />
Code-behind:
private void MyButton_Click(object sender, RoutedEventArgs e)
{
}
... View more
10-05-2010
08:54 AM
|
0
|
0
|
1139
|
|
POST
|
Are you referring to this sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Identify If yes, you can clear the graphics layer by doing the following:
GraphicsLayer layer = this.MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
if (layer != null)
layer.Graphics.Clear(); // or layer.ClearGraphics();
where "MyGraphicsLayer" is the ID of the layer whose graphics you need to clear. Also to ensure that IdentifyTask is no longer performed on MouseClick, you can either * unsubscribe to this event so succeeding MouseClicks do not perform an IdentifyTask, or this.MyMap.MouseClick -= QueryPoint_MouseClick; * use a private boolean to denote if IdentifyTask need to be created and check if that is true/false before performing an IdentifyTask. bool identifyTaskEnabled = false; //set to true/false private void QueryPoint_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e) { if (!identifyTaskEnabled ) return; // to skip the code that follows ... //IdentifyTask code goes here }
... View more
10-04-2010
04:03 PM
|
0
|
0
|
776
|
|
POST
|
You don't need to set ItemSouce in XAML anymore, if you are already creating the binding in code-behind. This should be enough to set the ItemSource. combo.SetBinding(ComboBox.ItemsSourceProperty, resultFeaturesBinding) However, you need to define the ItemTemplate for your combobox. Note that this is case-sensitive and should match the field you are binding to.
<ComboBox x:Name="combo" Width="200">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding TRACT}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
... View more
10-04-2010
03:49 PM
|
0
|
0
|
381
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-11-2025 01:30 PM | |
| 1 | 06-06-2025 10:14 AM | |
| 1 | 03-17-2025 09:47 AM | |
| 1 | 07-24-2024 07:32 AM | |
| 1 | 04-05-2024 06:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-12-2026
09:38 AM
|