Ticket Q425624
Visible to All Users

Get access to the XafApplication

created 12 years ago

Hello, I have XAF application and some custom form.
How can I get access to the XafApplication instance in my custom form through a constructor??? Please help me with code.

Answers

created 12 years ago (modified 12 years ago)

Hello Mihail,
Thank you for contacting us. Please review the How to show custom forms and controls in XAF (Example) example. It shows how to pass the XafApplication instance in a scenario when a custom form is invoked from a Controller.
In ASP.NET, you can use the static WebApplication.Instance property. There is no such property in WinForms, I am afraid. But you can implement your own static class (e.g., ApplicationHelper) and initialize its XafApplication property after you create your XafApplication in the Main routine.
I hope this helps.

    Comments (2)
    W W
    Willem de Vries 9 years ago

      Blog no longer available. :(

      Dennis Garavsky (DevExpress) 9 years ago

        @Willem: I hid the deprecate blog link, but the first link from my original answer is still valid. Also, in the latest XAF version, there were improvements that simplify accessing the XafApplication and IObjectSpace entities from within custom controls: How to: Show a Custom Data-Bound Control in an XAF View (WinForms). Please take another moment to review these learning materials and let me know if you require further assistance after this. If so, create a separate Support Center ticket, and describe your use-case scenario and current implementation difficulties with it and XAF.

        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.