Ticket T357698
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

WinForms - How to display geospatial information in XAF Views using Google, Bing or OpenStreet maps

winforms custom listeditor

created 9 years ago (modified 9 years ago)

Dear support,

I have managed to create a win forms xtramap list editor, but am stuck with a couple of features ( Please review attached sample ):

1  I have a  right mouse click handler to drop pushpins on the map, and an associated action to save the new locations associated with the pushpin  to the database.  I would prefer to deliver these action through a context menu, but I cannot get the xaf popup menu to work. I Cannot find  a context menu template property on the xtramap control. ???.

I have tried to  create this functionality ( in place popup menu)  myself using example T221559, but cannot get this to work properly ( code is commented out in  MapControl_MouseButtonDown.

Can you please advise how I can get the standard listvieweditor popupmenu to work or show me how to fix the commented out code ?

2 I have coded a left mouse button \ hold down to drag pushpins around the map, and the same action as above to save the changed locations to the database, however, this action interferes with the listeditor's click action. When the user clicks on the pushpin, it moves the pushpin slightly. Can you give me some advise on how to code around this ? ( with a working popup I can probably work this out myself :-))

3 When I close or save and close the list editor I receive and exception in the save and close action controller. There is probably something I coded up wrongly in the customer list editor. Can you please have a look at that and advise ?

Regards

Leo

Comments (1)
Anatol (DevExpress) 9 years ago

    We need additional time to research these issues. Please bear with us.

    Answers approved by DevExpress Support

    created 9 years ago

    Hello Leo.

    I have reviewed your code and found that basic list data handling is not fully implemented in your list editor. In the Refresh method, you create MapPushpin objects for each data record, but changes made to these 'pushpins' do not affect the source data records. I recommend you handle the map item events to update related business objects or update them when pushpins are moved in code.
    Also, when a new pushpin is added, create a new instance of the business object for it. This approach should help you avoid the third issue, which is caused by the fact that your GetOrderedObjects method returns a list of 'null' objects, instead of returning a list of business objects.

    The second issue is caused by the fact that in the mapControl_MouseUp method, you set the item's Location property to the location corresponding to the mouse pointer. In fact, the clicked item's location is not always its anchor point. Generally, it can be anywhere in the item's icon area. I recommend you store the pointer location in the MapControl_MouseButtonDown method and compare it with the location in the mapControl_MouseUp method to determine if the pointer was moved and how far.

    As for context menu, refer to the How to: Support a Context Menu for a Custom WinForms List Editor article.

    We look forward to your reply once you’ve had the opportunity to implement these suggestions.

      Show previous comments (1)
      DevExpress Support Team 9 years ago

        Thanks for your reply.

        I have researched the issue and found that the approach described in the How to: Support a Context Menu for a Custom WinForms List Editor article doesn't work. Instead of the IDXPopupMenuHolder, implement the DevExpress.ExpressApp.Win.SystemModule.IContextMenuTarget interface in a similar manner.

        In addition, apply the solution suggested in the Map Control: The map keeps moving when displaying a Popup ticket.

          Thanks for your help Michael.

          I got it all working, and learned a lot.

          I have updated the sample for other developers to review\use, but realize I need to change the ticket from private to public, and I don't know how to.

          Alternatively I can post it as a comment  against one of the other winforms map control tickets.

          Regards

          Leo

          DevExpress Support Team 9 years ago

            I have published the ticket. Please let me know if you need further assistance.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.