Ticket Q34001
Visible to All Users

How to display a list of non-persistent objects while retaining the possibility to 'add' new objects

created 16 years ago
Show previous comments (2)
H H
Henk van Jaarsveld 16 years ago

    Dan,
    Thanks for your time.
    For the moment I have found a workaround (see below), but as this feels more like a hack than a solution, I would be happy when you still can answer my question.
    The problem I had was that I was trying to keep a part of my businessmodel outside of XAF (because I may have a need to use it outside Xaf-applications also), but I would keep the possibility to use those objects within IList-properties in my Xaf-application.
    So I have:
    MyApplication.Module
    class PersistentObject : BaseObject
    {

     private IList<SimpleObject> simpleObjects
     public IList<SimpleObject> SimpleObjects
          {
             get { return simpleObjects
          }

    }
    Non-XAF Assembly:
    public class SimpleObject
    {
     public string Name {get;set;}
     public int Age {get;set;}
    }
    On a DetailView of PersistentObject, a nested listview for SimpleObject will be shown. As SimpleObject is not persistent, indeed it should not be possible to invoke a detailview for SimpleObject. But IMHO the XtraGrid used in WinForms should be able to add / modify the items via the inplace-editors and using the embedded navigator.
    Ok, maybe XtraGrid needs an IBindingList instead of IList to be able to create new objects, I'm not so sure about that, but that would be no problem.
    Currently: I have wrapped my non-persistent objects in [NonPersistent] XPObjects for use in my Xaf-application, but as said, this solotion feels more like a 'hack' than a real solution.
    To answer your specific questions:
    Why a non-peristent object: Because I don't want the containing assembly to rely on Xaf / XPO. However, the assembly will also be used within a Xaf-application.
    Create or link objects: Just creation.
    Process changes: There can be various ways. Using the DetailView in a PopupWindow and hanlding OnExcecute, using a SimpleAction, maybe embedding a DetailView on a Frame into a XtraWizard Page, you name it…
    I hope this is more clear now.
    Thanks in advance…
    Marco

    DevExpress Support Team 16 years ago

      Hello Marco,
      Also, you can enable the "New Item Row" feature of the XtraGrid control and use the System.ComponentModel.BindingList<T> class.
      Or, create a new SimpleAction/ShowPopupWindowAction and create/add objects manually. Currently, you need "wrap" classes, if your classes are not marked with the "NonPersistent" attribute (we will remove this requirement in future).
      See also:
      - "XAFCore: Introduce a capability to show a list of calculated (created at runtime) objects with easy" at http://www.devexpress.com/issue=S19068
      Thanks,
      Dan

      H H
      Henk van Jaarsveld 16 years ago

        Dan,
        New Item Row feature would serve me indeed as well. So it's possible using BindingList.
        Thank you very much, the answer perfectly fits my question.
        Marco

        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.