Jennifer,Thanks for the reply,So I went ahead and added two attachment editors and the right attachment editor is activated when the correct feature layer is selected (using the selection or add button from the editor tool bar).Here's my xaml
<!-- Attachment Tools -->
<!-- FeatureLayer="{Binding Layers[DISTRICTPOINTS], ElementName=Map}"-->
<Grid x:Name="AttachmentGrid" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,160,15,0" Visibility="Collapsed">
<Border Background="{StaticResource CommonPanelBorderBackgroundBrush}" BorderBrush="{StaticResource CommonBorderBrush}" BorderThickness="1" CornerRadius="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Border Effect="{StaticResource miniDropShadow}" Style="{StaticResource RibbonElementBorder}" Padding="15" Margin="10" >
<StackPanel Orientation="Vertical">
<TextBlock Text="Click on a point feature to select it, and click the 'Add' button to attach a file."
Width="275" TextAlignment="Left" Margin="20,20,20,5" TextWrapping="Wrap" FontWeight="Bold"/>
<esri:AttachmentEditor x:Name="MyAttachmentEditor" VerticalAlignment="Top" Margin="20,5,20,20"
Background="WhiteSmoke" Width="280" Height="190" HorizontalAlignment="Right"
FeatureLayer="{Binding Layers[TPOINTS], ElementName=Map}"
Filter="All Files (*.*)|*.*|Image Files|*.tif;*.jpg;*.gif;*.png;*.bmp|Text Files (.txt)|*.txt"
FilterIndex="1" Multiselect="True"
UploadFailed="MyAttachmentEditor_UploadFailed">
</esri:AttachmentEditor>
<esri:AttachmentEditor x:Name="MyAttachmentEditor1" VerticalAlignment="Top" Margin="20,5,20,20"
Background="WhiteSmoke" Width="280" Height="190" HorizontalAlignment="Right"
FeatureLayer="{Binding Layers[TLINES], ElementName=Map}"
Filter="All Files (*.*)|*.*|Image Files|*.tif;*.jpg;*.gif;*.png;*.bmp|Text Files (.txt)|*.txt"
FilterIndex="1" Multiselect="True"
UploadFailed="MyAttachmentEditor_UploadFailed">
</esri:AttachmentEditor>
</StackPanel>
</Border>
</Border>
<Image Source="images/CloseX.png" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="3" Stretch="None" Cursor="Hand" ToolTipService.ToolTip="Close" MouseLeftButtonUp="ViewAttribute_Click" >
</Image>
</Grid>
<!-- END Attachment Tools-->
Here's my code behind
private void EditorWidget_EditCompleted(object sender, Editor.EditEventArgs e)
{
if (e.Action == Editor.EditAction.ClearSelection) //|| e.Action == Editor.EditAction.Select
{
MyAttachmentEditor.GraphicSource = null;
MyAttachmentEditor1.GraphicSource = null;
}
else if (e.Action == Editor.EditAction.Add || e.Action == Editor.EditAction.Select)
{
foreach (var edit in e.Edits)
{
if (e.Action == Editor.EditAction.Add || edit.Graphic.Selected)
{
MyAttachmentEditor1.GraphicSource = edit.Graphic;
MyAttachmentEditor.GraphicSource = edit.Graphic;
break;
}
}
}
This is all working and as I previously stated when the correct feature layer is selected (using the selection or add button from the editor tool bar) the correct attachment editor is activated and I can attach a picture. So I was wondering instead of adding a drop down list and since this is already being controlled by the select and add button on the editor tool bar; could I just throw a if statement in there to control which attribute editor to display? Something like this but I am not sure what to write:
if (e.Action == Editor.EditAction.Add || edit.Graphic.Selected)
{
// MyAttachmentEditor1.GraphicSource = edit.Graphic;
// MyAttachmentEditor.GraphicSource = edit.Graphic;
if (var edit in e.Edits == polyline)
{
MyAttachmentEditor1 = Visibility.Visible;
MyAttachmentEditor1.GraphicSource = edit.Graphic;
{
if (var edit in e.Edits == point)
{
MyAttachmentEditor = Visibility.Visible;
MyAttachmentEditor.GraphicSource = edit.Graphic;
{
break;
}
What I'm having trouble with is the if clause...can you help??ThanksDave