544 views
in GUI Development by
How can I show an item of a VerticalList as selected at runtime ?
I have tried to set the property SelectedItem, but the list shows always the first item as selected.
I use a Slide Touch Handler to scroll the list. Maybe I have to force it scrolling to the position of SelectedItem?

best regards

G. Mangiameli

1 Answer

0 votes
by

Hello,

please see the section Select an item within the list. It contains an example demonstrating the selection of items. This works well if you have single selection only.

If your application requieres to have several items selected simultanously, the above approach with SelectedItem witll not work. In such case you have to:

1. adapt the data storage where the item contents are stored to maintain an additonal 'selected' state as boolean flag.

2. When loading the items in OnLoadItem, evaluate the 'selected' state of the coresponding entry in data storage and adapt the item to appear as selected or not selected.

3. If you select/deselect an item, just toggle the 'selected' state in the corresponding entry in your data storage and force this item to be reloaded. Thereupon the list will invoke (if necessary) the OnLoad method and refresh the affected item with its actual selected state.

Best regards

Paul Banach

by
It's not what I meant. I didn't explain it properly.
I use a VerticalList like in the example AnimatedList. I have a top list, a bottom list and a main list.
The main list shows always the actual selected/active item. When I load the list automatically the first item is shown in the main list.
I want to find a way how to change programmatically at runtime the item visible in the main list.

Best Regards

G.Mangiameli
by

Hello,

ok. In such case with the property ScrollOffset you can control the scroll position in pixel of the list content. With the method EnsureVisible() you can instruct the list to automatically adjust its scroll position so that a given item is visible. More details and examples are found in the section Scroll the list items.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...