<DataTemplate x:Key="CommentInfoWindowTemplate"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="30" /> <RowDefinition Height="100" /> <RowDefinition Height="30" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="150" /> <ColumnDefinition Width="300" /> </Grid.ColumnDefinitions> <TextBlock Grid.Row="0" Grid.Column="0" Text="Comment for user: " Foreground="Black" FontSize="12" /> <TextBox x:Name="UserID" Grid.Row="0" Grid.Column="1" /> <TextBlock Grid.Row="1" Grid.Column="0" Text="More Text" Foreground="Black" FontSize="12" /> <TextBox x:Name="CommentText" Grid.Row="1" Grid.Column="1" /> <Button Grid.RowSpan="2" Grid.Row="2" Content="Save" /> </Grid> </DataTemplate>
<DataTemplate x:Key="NewCommentInfoWindowTemplate"> <Grid x:Name="LayoutRoot" Background="White"> <Grid.RowDefinitions> <RowDefinition Height="20" /> <RowDefinition Height="30" /> <RowDefinition Height="200" /> <RowDefinition Height="30" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="134" /> <ColumnDefinition Width="316" /> </Grid.ColumnDefinitions> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0" Grid.ColumnSpan="2"> <Image x:Name="Dismiss" Style="{StaticResource dismissButton}" Height="20" ToolTipService.ToolTip="Exit" Cursor="Hand" MouseLeftButtonDown="Dismiss_MouseLeftButtonDown" /> </StackPanel> <TextBlock Text="Comment for user: " Grid.Row="1" Foreground="Black" FontSize="12" FontWeight="Bold" VerticalAlignment="Top" Margin="2" /> <TextBlock x:Name="UserID" Text="{Binding ID}" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" Margin="2" HorizontalAlignment="Left" Foreground="Black" FontSize="12" FontWeight="Bold" /> <TextBlock Grid.Row="2" Text="Comment:" Foreground="Black" FontSize="12" FontWeight="Bold" Margin="2" VerticalAlignment="Top" /> <TextBox x:Name="CommentText" Grid.Row="2" Grid.Column="1" Margin="2" VerticalAlignment="Stretch" /> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="3" Grid.ColumnSpan="2"> <Button x:Name="SaveComment" Content="Save" Margin="2" MouseLeftButtonDown="SaveComment_MouseLeftButtonDown" Cursor="Hand"/> </StackPanel> </Grid> </DataTemplate>
<esri:InfoWindow x:Name="NewCommentInfoWindow" Grid.RowSpan="2" Padding="2" CornerRadius="20" Background="White" Map="{Binding ElementName=Map}" ContentTemplate="{StaticResource NewCommentInfoWindowTemplate}" />" />
private void CaptureComment_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e) { //The actual coordinates ESRI.ArcGIS.Client.Geometry.MapPoint clickPoint = e.MapPoint; //Open the comment entry form and pass the coordinates ESRI.ArcGIS.Client.Geometry.Geometry g = clickPoint; Map.PanTo(g); NewCommentInfoWindow.Anchor = clickPoint; NewCommentInfoWindow.IsOpen = true; //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate FSRMapApplication.UserID ui = new FSRMapApplication.UserID(UserID); CommentInfoWindow.Content = ui; }
foreach (Graphic g in selected) { MyInfoWindow.Anchor = e.MapPoint; MyInfoWindow.IsOpen = true; //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate MyInfoWindow.Content = g.Attributes; return; }
InfoWindow window = new InfoWindow() { Anchor = e.MapPoint, Map = MyMap, IsOpen = true, ContentTemplate = LayoutRoot.Resources["LocationInfoWindowTemplate"] as System.Windows.DataTemplate, //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate Content = e.MapPoint };
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.