First element of imagelist selected - vb.net

I have an issue with an image List which I use for a treeview that I fill with items. By some properties of these, I select an image from the imageList.
My problem is that when I load my list of items in the treeview, the first one gets the first image of the imageList and then it gets the image I set.
By reading the documentation, It seems that there is no way to avoid the first element of the imageList to be selected but there must be some kind of trick I can use.

Related

TornadoFX: Layout of listview shifts if content is modified

I have a ListView inside of a TornadoFX form builder field that can be added to and removed from by some buttons off to the side. However whenever the contents of the list is modified from the buttons, the list moves vertically downwards. The height of the ListView remains the same, but it's almost as if there is padding being generated along the top whenever the content length is modified. The height change is then reset as soon as there is some change in focus, either by clicking on another component in the view, or by unfocussing and refocussing the window.
I've tried to limit the ability for this to happen by enforcing a max height, both on the form field and on the ListView itself, but neither worked.
Using listeners to print out all the values I could think of that would result in this change, I found that the "bounds in Parent" were changing, adding a value of 17 to both the minY and maxY values. I've not been able to determine where this value of 17 comes from.
The current code for the view is here: https://pastebin.com/6qFVvxvP
I also have some images to help visualize what the problem is:
Before removing content:
After removing content:

single item is showing in recycler view even though the entire screen is empty error?

Even though the entire screen is empty only one element is visible in recycle(r) view list. I have used wrap_content for height but still it is showing single element.But when I scroll that single element second element comes in first's place.Why is it happening ?
Check the item layout of recyclerview,the height of your item maybe is match_parent.It's different from the listview item.

Scroll to index in GridView

I have a GridView with n number of items. Only 50 are loaded in at a time. Is there a way to jump the GridView control to a specific index without just scrolling through the GridView until that item is available? I dont want to do it that way for obvious visual and memory reasons.
Thanks,
Dom
I'd look into ISupportIncrementalLoading to support data virtualization. That way your ItemsSource might say it has 1000 items, but not load them all and your GridView will be able to skip to say 600-700 range and your ItemsSource will only load the items from that specific range. You can then use the ScrollIntoView() method to do the actual scrolling to the specified item.

Form elements order

I have added an labels on the PictureBox element, due to a fact that PictureBox is dynamically resized while loading (not very important in this case what does it load)... the problem is that the labels are under the picturebox elements, and arent visible when picturebox is over them.
Is there any solution to set the labels display order to the top available?
You can use the BringToFront method.
label1.BringToFront()

WP7 Get visible items in listbox

I have a listbox in a WP7 application and I would like to retrieve a list of visible items in the listbox. Actually, I am trying to retrieve the object that is visible so that when my application is tombstoned, I can resume it and write listbox.ScrollIntoView(lastVisibleItem);
If it matters, listbox is bound to a collection of custom objects with a datatemplate for customizing the way it looks.
Thanks in advance.
It's possible to work out how far the list has been scrolled using the technique detailed in this answer.
You could then calculate which item(s) are displayed based on the size of the list and the height of the items displayed.
If different items can be diffferent sizes then this becomes more difficult as you need to consider the height of each individual item.
You also need to remember that only part of an item may be displayed.