[Mono-winforms-list] DataGridView with Multiselect and Databinding doesn't work with Ctrl button

sharkal wolfgang.ginner at kapsch.net
Fri Mar 9 12:18:32 UTC 2012


Hi,
I have a DataGridView with Multiple Selection allowed and use Databinding to
add rows dynamically by SW.
The problem is, that the Multiple Selection in Linux doesn't work correctly,
when i use the Ctrl button to select  the rows, but when i used the shift
button, multiple selection works correctly. When i use the Ctrl button, the
multiple selection only works, when i don't press into the datarow, but on
the left side of the datagrid.
I already verified, that the multiple selection with the ctrl button works
fine, when i don't use databinding and add the rows just so. 
I think it's a very strange behavior ( shift works, but ctrl  not ; without
databinding it works, but not with)
In Windows, the code works correctly.

Does anyone has an idea, how this could be ?

The code, when i do the databinding to the DataGridView is the following:

                bindingSource.Clear();
                if (bindingSource.DataSource == null)
                {
                    bindingSource.DataSource = new
AdvancedList<TransceiverListItem>();
                }
                foreach (TransceiverListItem t in
_viewModel.TransceiverListItems)
                {
                    if
(!((AdvancedList<TransceiverListItem>)bindingSource.DataSource).Contains(t))
                    {
                        AddItemToBindingSource(t);
                    }
                }
                // for a better performance
                dgVTransceivers.SuspendLayout();

                // set the binding source
                var sup = bindingSource.SupportsSorting;
                dgVTransceivers.DataSource = bindingSource;

                if (dgVTransceivers.Rows.Count == 1)
                {
                    if (Environment.OSVersion.Platform == PlatformID.Unix)
                    {
                        dgVTransceivers.Rows[0].Selected = true;

                    // special case in mono...because of some wrong
behaviour of the datagrid implementation
                    // not all events are fired correctly under mono

                        var transceiver =
dgVTransceivers.SelectedRows[0].DataBoundItem as TransceiverListItem;
                        if (transceiver == null) return;

                        ViewModel.UserWantsToLoadDetails(transceiver.Id);
                    }
                }

                dgVTransceivers.ResumeLayout(false);

--
View this message in context: http://mono.1490590.n4.nabble.com/DataGridView-with-Multiselect-and-Databinding-doesn-t-work-with-Ctrl-button-tp4459309p4459309.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.


More information about the Mono-winforms-list mailing list