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.
That is it must change the CurrencyManager's position when a certain item is selected. Just like a standard comboBox does.
Workaround
Use the LookUp editor with the following code for the EditValueChanged event:
private void lookUpEdit1_EditValueChanged(object sender, EventArgs e) { LookUpEdit lookup = sender as LookUpEdit; BindingManagerBase bm = BindingContext[lookup.Properties.DataSource]; bm.Position = lookup.Properties.GetDataSourceRowIndex(lookup.Properties.ValueMember, lookup.EditValue); }
Private Sub lookUpEdit1_EditValueChanged(ByVal sender As Object, ByVal e As EventArgs) Dim lookup As LookUpEdit = TryCast(sender, LookUpEdit) Dim bm As BindingManagerBase = BindingContext(lookup.Properties.DataSource) bm.Position = lookup.Properties.GetDataSourceRowIndex(lookup.Properties.ValueMember, lookup.EditValue) End Sub
This doesn't appear to work if the lookupedit is sorted.
Hello,
This code snippet operates data source indices. Thus, it should work properly when the lookup is sorted. I have attached a sample project and video.
Please check the project and modify it to illustrate your scenario.
I'm working on a project using DevExpress controls. My employer paid a ton of money for them. Please tell me this 7 year old DEFECT is fixed. It doesn't seem to be…
I tested further. No, this horrible DEFECT (BUG) is still not fixed. You people say that it is "designed behavior", but you know that a bindable control should move the position of the BindingSource. Period, end of story. We all know it and you all know it, so stop being FEMS and own up to it. Most of all, fix this STUPIDITY. You people charge money for this?
In addition, your so-called "workaround" above, in VB.NET, suffers from two problems:
If the user selects the record at index 0 the binding manager isn't going to change position (from zero). Therefore, the BindingSource.CurrentChanged event won't fire. The need to work around your crap 'workaround' is utterly disappointing. How much money do you people spend to release broken controls? How embarassing…
Private Sub SearchEmployeeGridLookUpEdit_EditValueChanged(sender As Object, e As System.EventArgs) Handles SearchEmployeeGridLookUpEdit.EditValueChanged
Dim editor = DirectCast(sender, GridLookUpEdit)
If Not IsNothing(editor.Properties.DataSource) Then
Dim manager = Me.BindingContext(editor.Properties.DataSource)
Dim index = editor.Properties.GetIndexByKeyValue(editor.EditValue)
If index = 0 Then
manager.Position = 1
End If
manager.Position = editor.Properties.View.GetDataSourceRowIndex(index)
End If
End Sub
Hello,
To process your recent post more efficiently, I've created a separate ticket on your behalf: LookUpEdit doesn't synchronized with CurrencyManager. Please refer to it for the further communication.
Hello Stas,
unfortunately the other new ticket is now private, but I'm also very interested in a solution here.
I also have to use this messy work-around and (although in C#) I don't understand the same as VB Man why this is not directly part of the DevExpress LookUp implementation.
Therefore please stay with this public ticket or make also the other new ticket public that also other customers like me can read new comments on this topic!
Best regards and thank you
Andreas
Hello Andreas,
I've marked LookUpEdit doesn't synchronized with CurrencyManager as public. Now you can refer to it.
Great, thanks Stas!
You're welcome!