View previous topic :: View next topic |
Author |
Message |
jwat Guest
|
Posted: Thu Nov 10, 2005 9:31 pm Post subject: editor question |
|
|
I have one editor that is used by 2 columns and whenever I change a value all the values in all the rows of those two columns get changed to the same thing. Please tell me what I am doing wrong. The editor uses the Infralution.Controls.VirtualDropDownList control and has UpdateValueEvent set to SelectedItemChanged and the ValueProperty set to SelectedItem. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Nov 10, 2005 9:37 pm Post subject: |
|
|
Are you setting the editor up at design time (using the Virtual Tree designer)? What is the DisplayMode for the editor (Always or OnEdit)? We may need a sample project just to see what you have done - you can email one to support@infralution.com _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Nov 11, 2005 10:29 pm Post subject: |
|
|
Thanks for the sample project. It took a little while to see what was going on. The problem was occurring because you have two DropDownList controls both bound to the same DataSource. The .NET databinding design includes a mechanism to keep the selected items of databound controls (bound to the same datasource) on a form in sync via the BindingContext/CurrencyManager. In this case this means that selecting an item in one dropdown will cause it to be selected in the other. There are two possible solutions:
a. Use two separate controls bound to two separate datasources
b. Inhibit the currency manager mechanism for this datasource. You do this by placing the line of code:
Code: | this.BindingContext[styles].SuspendBinding(); |
following creation of your styles datasource _________________ Infralution Support |
|
Back to top |
|
|
Guest
|
Posted: Sun Nov 13, 2005 1:11 am Post subject: one final question |
|
|
one final question unrelated to the initial problem but in the same project
The first column header has extra space to the left where the text doesn't go. How can get rid of that? To reproduce just add a row enter data in all the fields and look at the alighnment of the first column compared to all the rest. I guess this is where an icon can go but as I am not using an icon how can I purge this extra space? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Nov 13, 2005 9:53 pm Post subject: |
|
|
The extra space is to display the expansion indicator and tree lines. If you are using Virtual Tree as a simple grid you can set IndentWidth to zero to remove this space. _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Nov 15, 2005 11:44 am Post subject: |
|
|
Actually the SuspendBinding solution above does not always work. For some mysterious reason the .NET framework reenables binding for the datasource in some circumstances. The proper solution is to ensure that each of the editor controls has its own BindingContext and so is not connected to any other. To do this you will need to add a handler for the CellEditor.InitializeControl event as follows:
Code: | private void cellEditor2_InitializeControl(object sender, CellEditorInitializeEventArgs e)
{
if (e.NewControl)
{
e.Control.BindingContext = new BindingContext();
}
} |
_________________ Infralution Support |
|
Back to top |
|
|
|