MultiSelect = FALSE Doesn't Work on LISTVIEW - winforms

Language :: Visual C++ Windows Form Application
Platform :: VS 2008 (.Net 4.0)
I am using the Checked ListView control. I have the "MultiSelect" option set to FALSE. This seems to work to only allow one row at a time to be highlighted.
What doesn't seem to be working though is the Check box associated with each item in the ListView. Even with "MultiSelect" = FALSE it is still allowing the user to check more than one item in the list.
I understand the basic premis behind the CheckBox . . . That it allows more than one item to be selected. But, is there any way around this "feature"? Is there any way to limit only one item checked in a Checked ListView even with the "MultiSelect" option = FALSE?
I am desperate.
Thanks! :)

A quick fix could be to un-select all existing items before selecting the new one.

Related

ToolStripTextBox, ToolStripComboBox not automated

In UI Automation, when automating the toolstrip items we are facing an issue which is described below
I am adding toolstrip items as follows
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1,
this.toolStripButton2,
this.toolStripComboBox1,
this.toolStripButton3});
When running the UI Automation(System.Windows.Automation), UI automation finds the controls till toolStripButton2 (i.e) controls on the left side of toolstripcombobox is getting recognized but on the controls on the right side.(If i make the combobox to go the right most control everything works fine)
Note: In Inspect.exe tool from windows kits, all the controls are shown but when trying to access the last toolStripButton3 returns null.
Here i have attached the simplified code, the buttonCollection is expected to get 3 buttons but it gets only two in my case.
AutomationElement toolstrip = viewTab.FindFirst(TreeScope.Children,
new PropertyCondition(AutomationElement.AutomationIdProperty, "toolStrip1"));
AutomationElementCollection buttonCollection = toolstrip.FindAll(TreeScope.Children,
new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "button"));
Both ToolStripTextBox and ToolStripComboBox are showing the same behavior.
I would like know what is going wrong my approach.
I've posted one approach which would allow you to access all the buttons, in response to your question at https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/2363de9f-3bf0-48dc-a914-1eef5bcf1482/toolstriptextbox-toolstripcombobox-not-automated?forum=windowsaccessibilityandautomation.
Thanks,
Guy

WPF Toolkit Propertybox does not display nullable Enums

I'm currently using the Extended WPF Toolkit and from that i'm using the Propertybox. This box displays all properties of a bound element. While this works great, there is one problem. I'm using Nullable... so it does not display this enum correctly (it just gives a textbox). If i changed the enum to a normal enum (not nullable), then it displays the items correctly in a combobox.
To solve this, i tried the IItemsSource interface as described in the documentation, but this won't allow me to add a "null" value either.
I know i could solve this by adding a fake "null" value to my enumlist, but i would like to avoid this. Does anyone here know how i could make my nullable display correctly?
Kind regards
Tom
Control documentation:
https://wpftoolkit.codeplex.com/wikipage?title=PropertyGrid
UPDATE SOLUTION:
I "solved" it by using a different control. http://www.codeproject.com/Articles/87715/Native-WPF-4-PropertyGrid. This grid supports it out of the box.
SOLUTION: I "solved" it by using a different control. https://github.com/xceedsoftware/wpftoolkit. This grid supports Nullable out of the box, and has some filtering functions for the properties you want to display that are not included in the Community Edition of the WPF Toolkit.
Update 2020: Added link to current webpage.

Winforms Listview checkedItems missing

Basically, I have a listview inside my form. In order to make the process of selecting the different items in the listview quicker, i have to add a "select all items" checkbox.
For Each lvItem As ListViewItem In Me.lvwDatos.Items
lvItem .Checked = True
Next
That's about it, very simple. Once i click on the select all checkbox, i can see clearly how all the elements go into checked state. However, on the next step, when i want to loop through the selected items in my code and do whatever tasks should be applied to them, i'm finding that ALL elements are unchecked. What's making them loose their state?
Ok, nevermind, i found the problem...that's how it is supposed to be, there's no problem in the listview, it's just the chain of events that were taking place that broke it all...legazy code, as usual...
This is why I have designed Better ListView component which have this behavior fixed (and many other quirks of .NET ListView).
There is also a free Better ListView Express, if you are interested.
The checked item collection is maintained separately and you always get its actual state.

WPF Listbox Selection problem

I have a strange problem with a listbox. I added only the listbox and a button which adds items to the listbox. If I click an item in the listbox it seems to have some strange multi selection mode on or something... i recorded a short screen cast, see for your self:
http://www.youtube.com/watch?v=zV4424ipNEA
any ideas whats wrong?
That is a known issue, as all those strings are the same the selection gets confused because they all are essentially the same object. If you create two identical strings in .NET it does not necessarily create a new one but may reuse the first instance, i am not an expert on this though.
Either wrap the strings in a class (make them the Content of a ListBoxItem for example) or make sure the values are unique.

WPF Combobox with auto-complete/auto-filter?

I am eager to find some solid (free, Open Source, or tutorial/example) code to make a WPF Combobox do autocomlete/autofilter as the user types. But everything I've tried so far has had some sort of problem...
A Reusable WPF Autocomplete TextBox came close, but I can't get it to work with more than one filter (more info here).
WPF autocomplete textbox/combobox doesn't work for me because it inherits from UserControl, and thus doesn't support the DataTemplates I need (for showing/selecting the value of one property for an object with multiple properties).
Automatically Filtering a ComboBox in WPF didn't work because it doesn't seem to ever find the EditableTextBox portion of the inherited ComboBox code (via (TextBox)base.GetTemplateChild("PART_EditableTextBox") which seems to always returns null).
Building a Filtered ComboBox for WPF just gets stuck in a refresh loop then overflows the stack after I type just a few letters.
Other things I've considered:
I know that Windows Forms' Combobox control has AutoCompleteMode and I could embed it in WPF, but I can't imagine it would play very well with my WPF data bindings.
Perhaps it is too complex and I need to simplify, maybe by building one-dimensional (single-property) ObservableCollections for the ComboBoxen... However, the challenge of applying multiple filters (one set by another control's value, and one from what the user is typing) to multiple controls using different views of the same DataSet would require a ridiculous amount of processing power to destroy and rebuild the list every time the user types a character!
So... I'm at wit's end. Any suggestions?
If your Combobox has some data source attached to it ,
just make
1-IsTextSearchEnabled = true.
2-IsEditable = true.
you are good to go
Try this one:
http://blogs.windowsclient.net/dragonz/archive/2010/02/23/autocomplete-textbox-control-for-wpf.aspx

Resources