|
POST
|
You cannot use Element binding if _Map is not an element of your application. In other words, you can only use this Map="{Binding ElementName=_Map}" if you had <esri:Map x:Name"_Map"/> Since you define _Map in code-behind, you can also update your MagnifyingGlass' Map property in code behind: MyMagnifyingGlass.Map = _Map; Or you can define _Map as a StaticResource and update your binding. <esri:Map x:Key="_Map"/> private Map _Map = this.Resources["_Map"] as Map; Map="{Binding Source={StaticResource _Map}}"
... View more
10-06-2010
03:51 PM
|
0
|
0
|
680
|
|
POST
|
You are right, in this sample, what gets added are Point and Polyline features only. The snippet here was meant to be a guideline on how you can retain the graphics in your map if the layer that contained them were added/removed by some means. I added a note in my previous post that the code also needs some tweaking 🙂 Adding the fill of the polygon and its additional area information to your GraphicsLayer is not something you can do with our API at this point. This sounds like an enhancement request that I need to forward to our team lead.
... View more
10-06-2010
03:36 PM
|
0
|
0
|
2345
|
|
POST
|
You can do something like this: query.Where("not fieldname is null");
... View more
10-06-2010
03:33 PM
|
0
|
0
|
410
|
|
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
|
1267
|
|
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
|
1297
|
|
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
|
1267
|
|
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
|
1792
|
|
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
|
1437
|
|
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
|
902
|
|
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
|
1437
|
|
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
|
902
|
|
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
|
490
|
|
POST
|
Are you referring to samples from: http://esriurl.com/slsdk2 ? Which sample? Thanks.
... View more
10-05-2010
09:03 AM
|
0
|
0
|
696
|
|
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
|
1792
|
|
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
|
1438
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 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 |
| Online Status |
Offline
|
| Date Last Visited |
Monday
|