Customized properties in Devexpress Grid Binding


Author
Message
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've changed some property names to friendly names using custom code option in Business Object Mapper.

(Plus override GetCustomBindablePropertyDescriptors for these fields)

I've noticed that when this object was bind to a Devexpress Grid with business binding source, these properties were not seen in Devexpress Grid.

I've tested for Devexpress (Wrapped) Textbox. These fields were listed in the BindingField list of the textbox.

What is missing ?

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Do you have the same behavior with a DataGridView?  The reason I ask is so that you can determine the source of the issue.  If you have the same behavior in a DataGridView then you are probably missing something else in your BO.  But the IBindingList interface (which is used on on the BBS) uses the type descriptors to determine which fields will be avaialble, so if you have them defined in the GetCustomerBindablePropertyDescriptors then this may be an issue someplace else.
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I have base Business Object say (CustomersBase) and

Complex Business Object Say (Customers) which is inherited from CustomerBase.

I'm using Customers (Object) for binding. But  I've written override GetCustomBindablePropertyDescriptors on CustomerBase. I'll explore this situation.

There is need to get that code one level up to Customers object or This code will be required with two objects.

Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've repeated the task and everthing has worked. I assume that I may had something like typing wrong property names. There is no need to write override method for two objects (See my previous post).
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
After I've seen my customized property in my Devexpress Grid, I've changed all the properties with friendly names.

But I've not seen these properties in Devexpress Grid. (None of them) And Retrive fields button was disabled (There is nothing to retrive for the Devexpress Grid)

I could'nt understand what was happening.

For Testing, I've changed back one property back to its default. (No customization). Then, I've got only this property in Devexpress Grid. And I've also tried what was happening with DataGridView, The Result was the same. Only One property in the DataGridView.

My Custom Code for a field : (Use Custom Code option)

[Browsable(false),

BusinessFieldDisplayInEditor(),

Description("Group Id"),

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

public Nullable<System.Int32> pGroupId

{

get

{

object loValue;

loValue = this.CurrentRow["group_id"];

if (loValue == DBNull.Value)

{

return (Nullable<System.Int32>Winknull;

}

else

{

return new Nullable<System.Int32>((System.Int32)loValue);

}

}

set

{

if (value.HasValue)

{

this.CurrentRow["group_id"] = value.Value;

}

else

{

this.CurrentRow["group_id"] = DBNull.Value;

}

}

}

My Method

protected override FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()

{

return new FieldPropertyDescriptor[] {

new ReflectionPropertyDescriptor("pId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pGroupId", typeof(CompaniesBase)),

// new ReflectionPropertyDescriptor("pCode", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pName", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pCityId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pTownId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pCountryId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pZipCode", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pAdress", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pPhone1", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pPhone2", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pFax", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pRelatedPerson", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pEmailAdress", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pWebSiteAdress", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pTaxNumber", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pTaxOffice", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pPhoto", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pType", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pIsActive", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pRecordStamp", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pInsertedByUser", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pClientAccountId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pCreditAmount", typeof(CompaniesBase))

};

}


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
What does the declaration of your BO class look like?  In the GetCustomBindablePropertyDescriptors method, you are using the type of CompaniesBase, is this the class that your custom properties are defined within?  There is really not much that has to be done....if you have type descriptors create or have them defined in the GetCustomBindablePropertyDescriptors method, they should show up.  What does your BO Mapper settings for one of your custom properties look like?  Do you have any other options checked, like the Create Descriptor?  If so, then this is probably your issue.  You do not need that checked since you are defining the GetCustomBindablePropertyDescriptors.
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've checked "Use Custom Code" and No other option is selected in Business Object Mapper. Simply, I want to change the property names to more friendly names. For a field, I've got the generated code for a property, Pasted into Field's custom code section, Changed the property name. And Within my class (CustomersBase) overriden the method (GetDescriptors) with this property.

This was what I've followed. Is this a correct procedure ?

There is a conflict in my mind with custom properties. For above explanation, What I am doing is to change property name for a field. I'm customizing only the apperance of the property name. This is not a custom field according to my opinion. This is a customized field. When I reference to your documentation and forum posts, I see the Custom fields are the new fields that does not exist in the object. So they are defined in the object.

In my case, My customized property  are generated by the tool (uses the changed property code) with new name.

Is it near to give a friendly name in Business Object Mapper and to follow our business ?

Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've checked "Use Custom Code" and No other option is selected in Business Object Mapper. Simply, I want to change the property names to more friendly names. For a field, I've got the generated code for a property, Pasted into Field's custom code section, Changed the property name. And Within my class (CustomersBase) overriden the method (GetDescriptors) with this property.

This was what I've followed. Is this a correct procedure ?

There is a conflict in my mind with custom properties. For above explanation, What I am doing is to change property name for a field. I'm customizing only the apperance of the property name. This is not a custom field according to my opinion. This is a customized field. When I reference to your documentation and forum posts, I see the Custom fields are the new fields that does not exist in the object. So they are defined in the object.

In my case, My customized property  are generated by the tool (uses the changed property code) with new name.

Is it near to give a friendly name in Business Object Mapper and to follow our business ?

StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
We have added a new feature to 1.6.5 that will allow you to rename the fields generated by the BOMapper... the underlying field in the database will remain the same, but the property that exists on the business object will be renamed.  We will be releasing it shortly.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Actually this won't be included in the 1.6.5 release.  It will, however, be in the maintenance release immediately after the 1.6.5 (i.e. 1.6.5.1 build).  There are several things that we wanted to get in the 1.6.5 build that are not going to make it due to time contraints and testing.  This one change will require a bit of testing and is something that we didn't want to change this close to the final release.  But it will be coming. Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search