Hi,
I have a LookUpEdit that is bound to a BindingList<UserRole> via a BindingSource. Filling the values in the LookUpEdit works properly. The LookUpEdit show a single property from my T objects (the "RoleName" property, see code below).
Now I wanted to bind the "EditValue" property to a variable to find out which UserRoleo object is currently selected (i.e. I want to get the whole object!). So I used the following code ("lueControl" is my LookUpEdit control):
BindingSource userRoleSource = new BindingSource();
userRoleSource.DataSource = presenter.UserRoles;
lueControl.DataBindings.Clear();
lueControl.Properties.DataSource = userRoleSource;
lueControl.Properties.DisplayMember = "RoleName";
lueControl.Properties.Columns.Add(new LookUpColumnInfo("RoleName"));
lueControl.DataBindings.Add("EditValue", presenter, "SelectedUserRole", false, DataSourceUpdateMode.OnPropertyChanged);
I tried to bind the EditValue to the "SelectedUserRole" property in my presenter object. But whatever I try, it doesn't work. I always get an exception saying that binding to "SelectedUserRole" is not possible.
How must I do the binding so that I can get the whole UserRole object that is currently selected? What type must "SelectedUserRole" have? I tried the type "UserRole" (this is the type of the elements in my BindingList) and I tried the type "Object", but none of them worked.
Thanks for any help!
Best regards,
Oliver
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.
Hi there,
in the meantime I could resolve this issue. I had forgotten to add { get; set; } to the property I tried to bind the EditValue to. This caused the exception.
That happens when you're a relative newbie to DevExpress AND C# :-)
Sorry for the inconvenience
Oliver
I could solve the problem by myself.