Ticket Q579328
Visible to All Users
Duplicate

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

Integrate DevExpress Dashboard controls with WinForms and ASP.NET XAF applications

How to embed Devexpress Dashboard into an XAF application for both Windows and the Web

created 11 years ago

Hi,

is it possible to embedd devexpress dashboard into a devexpress xaf application?

it would also be good, if the security system from xaf can somehow be used. I guess row level security is not possible then, or at least not easy, but would be helpfull if i can at least say if someone can navigate to the the configured dashboard or not.

Do you have a simple solution for that? or a sample project?

Best regards
Michael

Answers approved by DevExpress Support

created 11 years ago (modified 8 years ago)

For versions 16.2+

In the version 16.2, The Dashboards Module is introduced to simplify the integration of DevExpress Dashboard controls with WinForms and ASP.NET XAF applications.

For versions prior to 16.2

I investigated your scenario and created a simple XAF application that shows data from a database using the XtraDashboard control. See the attached file for a complete solution.
In this solution, I introduced the following items:
- a new MyClass class (see the Solution2.Module\MyClass.cs file):

C#
[DefaultClassOptions, NavigationItem("XtraDashboard Demo")] public class MyClass : BaseObject { public MyClass(Session session) : base(session) { } public string MyProperty1 { get; set; } public string MyProperty2 { get; set; } public string MyProperty3 { get; set; } public string MyProperty4 { get; set; } }
Code

- a new Dashboard with a BindingSource object as a datasource (see the Solution2.Module\XtraDashboard1.cs file)
- a Model ViewItem interface (see the Solution2.Module\IModelXtraDashboardViewItem.cs file):

C#
public interface IModelXtraDashboardViewItem : IModelViewItem { }

- a new Navigation item with a XAF DashboardView (see the Solution2.Module\Model.DesignedDiffs.xafml file):

XML
<Application> <NavigationItems> <Items> <Item Id="XtraDashboard Demo" Caption="XtraDashboard Demo" IsNewNode="True"> <Items IsNewNode="True"> <Item Id="XtraDashboardDemo" ViewId="XtraDashboardDemo_View" Caption="XtraDashboard Demo" IsNewNode="True" /> </Items> </Item> </Items> </NavigationItems> <Views> <DashboardView Id="XtraDashboardDemo_View" Caption="XtraDashboard Demo" IsNewNode="True"> <Items IsNewNode="True"> <XtraDashboardViewItem Id="XtraDashboardViewItem1" IsNewNode="True" /> </Items> <Layout IsNewNode="True"> <LayoutGroup Id="Main" IsNewNode="True"> <LayoutItem Id="XtraDashboardViewItem1" ViewItem="XtraDashboardViewItem1" Index="0" IsNewNode="True" /> </LayoutGroup> </Layout> </DashboardView> </Views> </Application>

- a custom WinForms ViewItem class with a DashboardViewer component that is associated with the created Dashboard component (see the Solution2.Module.Win\XtraDashboardViewItem.cs file):

C#
[ViewItem(typeof(IModelXtraDashboardViewItem))] public class XtraDashboardViewItem : ViewItem, IComplexViewItem { public XtraDashboardViewItem(IModelXtraDashboardViewItem modelViewItem, Type objectType) : base(objectType, modelViewItem.Id) { } protected override object CreateControlCore() { objectSpace = application.CreateObjectSpace(); UserControlWithDashboard1 control = new UserControlWithDashboard1(objectSpace.CreateCollection(typeof(MyClass))); return control; } protected override void Dispose(bool disposing) { if (objectSpace != null) { objectSpace.Dispose(); } base.Dispose(disposing); } private IObjectSpace objectSpace; private XafApplication application; public void Setup(DevExpress.ExpressApp.IObjectSpace objectSpace, DevExpress.ExpressApp.XafApplication application) { this.application = application; } }

- a custom ASP.NET ViewItem class with a ASPxDashboardViewer component that is associated with the created Dashboard component (see the Solution2.Module.Web\ASPxDashboardViewItem.cs file):

C#
[ViewItem(typeof(IModelXtraDashboardViewItem))] public class ASPxDashboardViewItem : ViewItem, IComplexViewItem { public ASPxDashboardViewItem(IModelXtraDashboardViewItem modelViewItem, Type objectType) : base(objectType, modelViewItem.Id) { } protected override object CreateControlCore() { objectSpace = application.CreateObjectSpace(); ASPxDashboardViewer viewer = new ASPxDashboardViewer(); viewer.RegisterJQuery = true; viewer.DataLoading += viewer_DataLoading; viewer.DashboardSource = typeof(Solution2.Module.XtraDashboard1); return viewer; } void viewer_DataLoading(object sender, DataLoadingWebEventArgs e) { e.Data = objectSpace.CreateCollection(typeof(MyClass)); } protected override void Dispose(bool disposing) { if (objectSpace != null) { objectSpace.Dispose(); } base.Dispose(disposing); } private IObjectSpace objectSpace; private XafApplication application; public void Setup(DevExpress.ExpressApp.IObjectSpace objectSpace, DevExpress.ExpressApp.XafApplication application) { this.application = application; } }

Note that starting from version 15.1, the ASPxDashboardViewer.RegisterJQuery property is obsolete, and you need to use the embedRequiredClientLibraries configuration file's attribute, as described in the Embedding Required Client Libraries topic.
The 'XtraDashboardInXaf.png' and 'ASPxDashboardInXaf.png' screenshots demonstrate the resulting WinForms and ASP.NET applications.
Note that this approach is appropriate to integrate any your custom WindowsForms/ASP.NET solution to an XAF application. Note that XAF features like Security, Validation or ConditionalAppearance will not be attached to your controls and you need to implement them manually like in a common WindowsForms application.
Alternatively, you can use XAF DashboardView to build a simular user interface and use XAF features. Note that this solution is not based on the XtraDashboard component so some features will not be available.

    Show previous comments (8)
    Dennis Garavsky (DevExpress) 9 years ago

      @Fritz: I am afraid we do not have another ready sample or guidelines for integrating the Dashboard Designer in an XAF app. It would also be difficult to prepare such an example from scratch, because this feature is quite complex and this work should be first evaluated and planned not to break our existing release plans. Our team will surely take your request into account for the future, though.

      At this stage, I can give only the links to the general documentation on accomplishing such tasks as well as related samples and blogs. Note that these learning materials will require additional study of the concepts and code, which may be difficult or time consuming depending on your general experience with these things.
      Here we go:
      1. Dashboard - general documentation on the dashboard components and accomplishing tasks with them in non-XAF apps (you will generally need to use the same approaches here, because XAF is a regular .NET app built DevExpress controls);
      2. Using a Custom Control that is not Integrated by Default - general documentation on integrating custom controls in XAF apps;
      3. C:\Users\Public\Documents\DevExpress Demos 16.1\Components\eXpressApp Framework\XVideoRental\CS or the corresponding eXpand Framework source code at GitHub, because this demo is showing off certain eXpand features - look for the "DashboardDesigner" string. The Dashboard web integration module  and ASP.NET Dashboard Designer - XAF integration blogs provide additional information and links to important code files if you decide to research and use these features in your app or even code something similar on your own.
      4. How to show ASPxDashboardDesigner in a XAF application - this ticket contains information on accomplishing this task for a Web app.

      As for the difficulties with eXpand, it all looks like something was done wrong, e.g. an eXpand version, which is incompatible with your current DevExpress version, was downloaded. So, I suggest you give this framework another try. I've also contacted Apostolis Bekiaris, and he will follow up with you and provide help with this.
      Let me know if I can assist you further.

      FR FR
      Friedrich Rudolf 9 years ago

        Hello Dennis!
        Thank you very, very much for your detailed answer!  On the eXpand website I have often seen the large number of very interesting features and I would be happy if I could use it for my development. My concern related to eXpand was / is, just a litte, if I will use the eXpand Framework that I will leave the world of DevExpress XAF with all the detailed documentation, many samples and the perfect support.

        Dennis Garavsky (DevExpress) 9 years ago

          @Friedrich: Thanks for your sincere feedback. I've passed it to the eXpand Framework maintainers.

          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.