+ Reply to Thread
Results 1 to 5 of 5

Thread: Customized Identify Behavior

  1. #1
    Suja Sudhan
    Join Date
    Apr 2010
    Posts
    31
    Points
    0
    Answers Provided
    0


    0

    Default Customized Identify Behavior

    Hi,

    1. I do not want to use the standard Identify behavior in the map web part as I have a need to customize some of the attribute values. First, can someone tell if it is possible to customize the standard identify behavior?

    2. Assuming, I can't do the above, I have created a new behaviour using the IdentifyTask on mouse click. IdentifyTask is returning back the results correctly. But, I want to bring up an info window with these results. I have seen discussions like this in the Silverlight forum but all I want is create the info window entirely on code-behind. With the silver light example on Simple Info Window, I am struggling to understand how to set the content template from code-behind (i.e. in my custom behavior code) without having any reference to the xaml.

    Any pointer on this is much appreciated.

    Thanks!

  2. #2
    Florent PUPIER
    Join Date
    Jul 2012
    Posts
    5
    Points
    0
    Answers Provided
    0


    0

    Default Re: Customized Identify Behavior

    hi sthambir,

    Have you solved the first problem.
    I tri to add a custom Identify Behavior but I but I unable to show it in a map.
    I understand that we must add OnclickPopupInfo object, PopupItem and Popupinfo, but I dont know use it.

    Thk,

  3. #3
    Suja Sudhan
    Join Date
    Apr 2010
    Posts
    31
    Points
    0
    Answers Provided
    0


    0

    Default Re: Customized Identify Behavior

    hi,

    Yes, I have used InfoWindow which popups on feature mouse click (raised by attaching a mouse click event on the layer). Have used silverlight controls (stackpanel/text block/dock panel,etc) to create the required attribute window which is set as the content of the InfoWindow.

    This InfoWindow's anchor point is set to the mouse clicked position and then the InfoWindow is added to the visual tree to place it on top of the map. All of this is done in code behind and works very well.

    The only drawback is it doesn't bring back attributes of multiple features as the standard identify behaviour, only the top layer feature is returned currently. But, I am sure there should be a workaround for which I haven't spent time yet.

    Cheers.

  4. #4
    Florent PUPIER
    Join Date
    Jul 2012
    Posts
    5
    Points
    0
    Answers Provided
    0


    0

    Default Re: Customized Identify Behavior

    Hi,

    Can you send me your behavior?

    Thk,

  5. #5
    Suja Sudhan
    Join Date
    Apr 2010
    Posts
    31
    Points
    0
    Answers Provided
    0


    0

    Default Re: Customized Identify Behavior

    Code snippet below:

    Code:
    
    Capture click event on the layer:
    
    myGraphicsLayer.MouseLeftButtonUp += new GraphicsLayer.MouseButtonEventHandler(myGraphicsLayer_MouseLeftButtonUp);
     
    void myGraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
    {
        InfoWindow infowin;
        GraphicsLayer gl = (GraphicsLayer)sender as GraphicsLayer;
    
           TextBlock tb = new TextBlock();
           tb.Text = "My attribute content";
           tb.Margin = new Thickness(2);
           tb.FontSize = 14;
    
           //set the info window and its content to the text block (whatever control you are using)
                    infowin.Map = myMap;
                    infowin.Anchor = myMap.ScreenToMap(e.GetPosition(myMap));
                    infowin.Content = tb;
                    infowin.IsOpen = true;
                    infowin.Visibility = Visibility.Visible;
    
           //add infowin to the layout
           FrameworkElement parent = VisualTreeHelper.GetParent(myMap) as FrameworkElement;
           ((Grid)parent).Children.Add(infowin);
    }

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts