New Posts New Posts RSS Feed: Hide BindableList Properties
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Hide BindableList Properties

 Post Reply Post Reply
Author
kjohnson View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 19
Post Options Post Options   Quote kjohnson Quote  Post ReplyReply Direct Link To This Post Topic: Hide BindableList Properties
    Posted: 15-May-2009 at 12:42pm
I'm currently build an application using both DevForce classic and DevExpress tools.  I'm including the DevExpress End-User Report Designer so users can create custom reports.  I've managed to get it working by using the IdeaBlade BindableList<> as the datasource.  The main problem I've encountered is in which fields are available to the user. 

For instance I use a BindableList<Orders> as the datasource.  One of the fields in the Orders table is OrderDate, when the report designer looks for fields it finds the OrderDate property and OrderDateColumn which only displays on a report as [Model.Orders].  Basically, I want to keep these *Column properties from being shown.  I have been searching through the knowledge bases and forums for both IdeaBlade and DevExpress, and found several possible leads to make this happen, but none have worked so far.  Can someone point me in the right direction in how to hide certain properties.
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 15-May-2009 at 5:06pm
If I understand you correctly, I think you're asking for properties such as OrderDateColumn to be suppressed in the display presented by the DevExpress End-User Report Designer.  Unfortunately we have no control over that.  We do add BindingBrowsable attributes into the definition of properties that we generate (such as the following one for the OrderDatecolumn property an Order entity based on the Order table in our IdeaBladeTutorial database):

   [EditorBrowsable(EditorBrowsableState.Advanced)]
    [BindingBrowsable(false)]
    public virtual DataColumn OrderDateColumn {
      get { return TypedTable.OrderDateColumn; }
    }

Our ControlBindingManager designer (along with other DevForce components) respects this attribute and suppresses the display of properties that have it set to false, as you can see if you use the ControlBindingManager in laying out a WinForm.  But, as I say, we have no control over what the DevExpress report designer does.

If there is an attribute which that report designer respects (you will have to find this out from DevExpress), then you could override (in your Order developer class) the properties you don't want to display, adding the attribute there.  For example, here is an override of the OrderDate property that I've put in my Order class:

    [BindingBrowsable(false)]
    public override DateTime? OrderDate {
      get {
        return base.OrderDate;
      }
      set {
        base.OrderDate = value;
      }
    }

This causes OrderDate not to display in the ControlBindingManager designer, when ordinarily it would.*

--------------------------------------
* After you add such an attribute you will need to build your model, and at the very least close and re-open the form where you want to use the ControlBindingManager designer to get the change to kick in (past the caching done by Visual Studio). I actually closed and reopened Visual Studio to get the change to take.




Back to Top
kjohnson View Drop Down
Newbie
Newbie


Joined: 19-Nov-2008
Posts: 19
Post Options Post Options   Quote kjohnson Quote  Post ReplyReply Direct Link To This Post Posted: 18-May-2009 at 9:15am
The reason that I'm using the BindableList<> for the DevExpress report datasource is because it preserves the entity relations.  I can transfer the needed data by doing:

DataSet dataSet1 = mPersMgr.DataSet;

Unfortunately, when doing this the entity relations (such as the one that would connect Orders with OrderDetails) does not carry over into the dataset.  Is there a way to carry these relations into the dataset?

Alternatively, I can simply change the display name of the properties (using the system.componentmodel.displaynameattribute).  Is there a way I can write a small function to take any property that ends with "Column" and append "InternalOnly_" onto the front of its display name?  Or would I need to override each property?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down