Strange CheckedListBox control behaviour in .NET - c#

I have a checkedlistbox control on a form. The multicolumn property is set to true at design time as the items are supposed to be displayed horizontally.
when I run the form and click the last item all the items shift to the left a bit which is very awkward.
Why does this happen and what can be done to stop this behaviour.
I am using VS 2008 on Win7
Regards.
Hello everyone,
setting the ColumnWidth property of the checkedListBox control fixes this. I don't know if this is THE solution but it seem's to work properly.

Maybe it's related to something going on about the space needed for the scrollbar.
Maybe you can try to disable/force the horizontal/vertical scrollbars and see if this change something

Related

When I set the ListBox SelectionMode to "None", it doesn't react to DataSource changes

while searching for an answer, I found out it's an old "bug" in VS !(?) I am using VS2013. I simply don't believe that they didn't correct it, so I have to think it's intentional, or there's something I am not doing right...
I want to use ListBox to dislpay some simple results. I want that list to be read-only, items not selectable and so on. Just a display of a simple array of results.
I use an array as a datasource (lstBox.DataSource = somearray;), which I update by setting DataSource to null, then back to somearray. The problem is - if I set the listBox SelectionMode to "none", list gets stuck and it doesn't refresh anymore. I can't refresh it. If I set list as "disabled" instead, it's showing the results correctly, it's not selectable, no matter what SelectionMode says, but it's all greyed out... Any help on this ?
p.s. from what I've read, even setting datasource to BindingList or BindingSource doesn't rectify this problem...
SelectionMode does not have a None value in WPF. (although it had in WinForms)
In WPF, if you want to present items without allowing selection, you should use the ItemsControl class instead of the ListBox.
But I'm not sure whether you are using WPF or WinForms by reading your question.
I fixed this by setting the selection mode to "One" in the "formclosing" event.

TabStop is not working

We have a form and textboxes in it. All of control's tabindex are set correctly and TabStop = true.
When some textbox is focused and when I press tab, focus is not set on next textbox.
Note : Controls are in the panel and its TabStop = true
Set TabStop for the panel to false
Make sure that the tab indexes are like the following:
Remember that you have a nice tool to set the Tab indexes in Visual Studio:
My solution: Containers must have the tab numbers set correctly even though they are not stops. Finally working!
Old post and nothing here helped me.
Tried everything including to force .Select() e .Focus() on the controls.
For some reason taborder was behaving all in a funny order, even disabling/setting visible = false on one control other orders was wrong as if the tab index was working in reverse.
Only thing help was de Document Outline, you can open that box with Ctrl + W, U or by the menu on VS.
VIEW -> Other Windows -> Document Outline
It ill show your controls in a tree fashion.
Just drag the controls to the correct order, it ill affect the tab order.
Word of warning: I struggled a bit with it because dragging (in the Document Outline box) some controls inside a panel caused them to move to the top upper corner of the panel (in the Designer). Just dragged them back to the position in the Designer.
For some reason the order the controls are show in the Outline Document box affects tab behaviour in nasty ways.
Have you set the tab order correctly? Select the form in designer view and select View > Tab Order to set the correct order.
Set TabStop for individual controls. Remove it from panel.
Perhaps the TextBox that you can't tab from is a multiline TextBox with AcceptsTab set to true? This would cause the TextBox to consume the tab key itself.
I know this is an old post but I've just had a similar issue and thought I'd share my solution.
Check that you have set the TabIndex before adding the control to it's parents Control collection.
I noticed for the controls that were being skipped I was adding them to the parent before setting their TabIndex. Once I set the TabIndex and then added them to the collection they behaved as expected.
One thing to note is that Visual Studio showed the tab order I wanted but at run time it did not behave that way.

ComboBox Silverlight

I would like to have the standard silverlightcombobox behave like an html combobox.
So let's say I have a combobox for all states in the US, If I press the 'I' key, it should navigate the selected item to start at the I's ... Is there anyway to do this, it doesn't make sense that it's not built in functionality.
Maybe I missed the memo? Any ideas?
It's not something that comes as standard - even in Silverlight 4 (I hit this very problem today).
However, there are quite a few DIY implementations on the net:
http://gistom.blogspot.com/2009/12/silverlight-combobox-with-keyboard.html
http://www.codeproject.com/KB/silverlight/ComboBoxKeyBrdSelection.aspx
http://www.reflectionit.nl/Blog/PermaLinkd137c1f7-a515-4084-8199-f8b3cf892b8f.aspx
The author of the last post
created a small Behavior which fixes this problem. You can attach the KeyboardSelectionBehavior to a ListBox or ComboBox using Microsoft Expression Blend. You drag it from the Assets and drop it on your ComboBox or ListBox. If you have a custom ItemTemplate you will have to set the SelectionMemberPath property.
If you don't have access to Blend then just use the code as a template and edit the XAML by hand to produce the same result.

ListView control rendering issue with Groups, CheckBoxes and View mode SmallIcon

Microsoft MSDN site has next remark: "Any groups assigned to a ListView control appear whenever the ListView.View property is set to a value other than View.List."
My problem is that i like to have View set to SmallIcon.
In this mode ListView control is shifted left, and CheckBoxes are covered by left edge
How to solve this issue, or at least how is possible to shift rendering of control to the right. My OS is Windows XP Service Pack 3.
It looks like that ListView items with Groups and CheckBoxes shows correctly only when View set to Details.
Updated: Setting ListViewGroup.Header property will resets scroll position to 0. Is there are any other workaround except saving scroll position before assignment and restoring it afterwards.
try the following open source project to enhance the WinForm ListView. http://objectlistview.sourceforge.net/cs/index.html

Scrolling ListView with mouse wheel occasionally negates scroll

I'm having some trouble with the Win32 listview, and I hope someone has some wisdom. When scrolling very quickly (via the wheel), occasionally, the listview appears to scroll, only to jump back to the selected item so it is in-view. In other words, the list undoes your wheel scroll to show you the selected item at the top/bottom of the list. I realize this sounds very dubious, as the common controls have been beaten to death the world over.
Here's how you can replicate:
Load up a listview in report mode with about 500 items or so (exact count doesn't matter, you just want several screens of data).
Select an item in the list and remember what you selected.
Rapidly scroll the list with the wheel downwards (toward you). We're trying to scroll the selected item out of view as fast as possible. You probably have to use more force than you usually use on the wheel. This won't always happen. You may have to try several times.
Either the scroll will complete normally, or it will change its mind at the end and pull you back to a view where the selected item is on the screen.
This happens with both regular and virtual listviews. I've tested Win32 and C# on Windows 7 Ultimate.
I made a small WinForms app that exhibits the behavior (requires .NET Framework 3.5). If you'd rather not run arbitrary executables from strangers (I understand), make a new WinForms app, drop a listview in report mode in, add a column, and populate the list in the form load event with 500 increasing integers:
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 500; i++)
{
this.listView1.Items.Add(i.ToString());
}
}
I've noticed this behavior and it does seem to be built into the list view control. I can't see any reason why the functionality would be useful. I created a thread on this at Sysinternals Forums a while back. It might be useful.
"I realize this sounds very dubious, as the common controls have been beaten to death the world over."
ListView hasn't quite been beaten to death but it's on life support. Use a different control.
is it a custom list view (overriding drawing ?)
by the way, I faced (from what I understand) the same issue with a custom Listbox and found some help here :
http://aviationxchange.net/wikis/winforms/net-color-listbox.aspx (end of the document).
Hope this could help.
I was facing the same problem but I think I found the cause: I use a tool that allows you to configure the mouse buttons (X-Mouse Button Control). By disabling it, the problem disappeared like magic.

Categories