Ticket T172371
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

Displaying a MapControl in a tab which displays locations relating to properties of a parent object

created 10 years ago

I have an ICompany business object which contains a list of each of IStores and IOffices. The auto generated UI shows a Company containing tabs for the Stores and Offices lists, as required. I want another tab, which containing a MapControl which displays the Stores and Offices.

To that end, in DemoApp.Module.Win I have:

  1. created CompanyDashboardDetailView, which contains a MapControl.
  2. added a tab to ICompanyDetailView containing a CompanyDashboardViewItem (via MapDashboardViewItem)
  3. created MapDashboardViewController which attaches to CompanyDashboardDetailViews
  4. added code in that controller which adds the image tile layers, and attempts to add the offices/stores to the map

The problem is that I do not have access to the Company object - View.CurrentObject is null - see InitialiseMap() in MapDashboardViewController.

To begin with, I am not sure about the approach I have taken in 1-3, ieL whether I should be using a DashboardView.

Most importantly, how can I get access to the Company object and thus the Office and Store lists it contains?

Thanks

Answers approved by DevExpress Support

created 10 years ago

Hello Wade,
Thank you for the sample project.
Your MapDashboardViewController is activated in the NestedFrame, where you do not have access to the Company object. Access the parent Frame to get the Company object:

C#
Company comp = (Company)((NestedFrame)this.Frame).ViewItem.View.CurrentObject

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.