selecteditem

Get ValueMember of Selected item in ListBox

拥有回忆 提交于 2019-12-02 13:01:48
I've seen a couple of posts asking a similar question but I have not been able to duplicate the answers in my code successfully. The following code adds items and their value member to a list box. Public Shared Sub ListFiles(hTab As Hashtable) Debug.Print("create file and key" & Now) Dim Enumerator As IDictionaryEnumerator Enumerator = hTab.GetEnumerator() Dim MyKeys As ICollection Dim Key As Object MyKeys = hTab.Keys() If (hTab.Count > 0) Then For Each Key In MyKeys Dim sfileName As String = hTab(Key) Dim first As Integer = sfileName.IndexOf("_") Dim last As Integer = sfileName.LastIndexOfAny

ArgumentOutOfRangeException for ListViewItem when clicking 2nd time

余生长醉 提交于 2019-12-02 09:30:55
The method below when I click second time gives the ArgumentOutOfRangeException error, and says index 0 is not a valid index. In first click it works!? ListView FullRowSelect set true. I see this happens while pressing ALT and CONTROL keys. If I click without pressing those keys it gives no error or If click an empty row before clicking 2nd time it does not give the error. Is there a way to use those keys combination and clicking more then once ? private void MultipleToText(object sender, MouseEventArgs e) { if (li.SelectedItems.Count <0) return; int SetIndex = li.FocusedItem.Index; if

Selected Item data from a table to textbox in ZK

不问归期 提交于 2019-12-02 03:43:56
I'm developing a small web application for storing data of a hospital's patients in order to learn more about zk and it's amazing features. My goal this time is when I select a row (checkmark) I want to take the data of the row (red color) to their corresponding textbox (blue) and this works when I choose any row of the table: Maybe it's a kind of configuration of the listbox or maybe I have to implement a method to get what I want, I don't know. It will be great if you give me a hand with this. It's nice to see ZK is spreading and I hope you like it, I know I do like it. Your goal is actually

set selected value in angular5 ng-select programmaticaly

為{幸葍}努か 提交于 2019-12-02 02:49:46
I'm using angular5 ng-select component: https://github.com/ng-select/ng-select and try to set the selected value (programatically) when the container component first loaded (kind of default selected value set in the model). I didn't find any relevant attribute for it or for the isSelected for each item. Here is my code (filtered): HTML: <ng-select [items]="filter.values" bindLabel="text" bindValue="id" class="input-md" [(ngModel)]="filter.selectedValue"></ng-select> Model: export class FilterData { Name : string; FormattedName : string; values : Filter[]; selectedValue : Filter = null;

WPF: Listbox, centering selected item

为君一笑 提交于 2019-12-02 01:27:28
问题 Is it possible to always keep selected item in the middle of a listbox? If the user selects an item, I want to scroll so that the newly selected item is in the middle. I guess it want be possible for the 'edge cases' (the first and last few items), but that's ok. 回答1: David Anson posted some articles on his blog that might help you here: Part 1 and Part 2. He gives an extension method that centers an item in an List Box. You might be able to build on that. 回答2: It is possible with couple of

WPF treeview itemselected moves incorrectly when deleting an item

ぐ巨炮叔叔 提交于 2019-12-02 00:49:30
I have a treeview bound to an object tree. When I remove an object from the object tree, it is removed correctly from the tree view, but the treeview's default behaviour is to jump the selecteditem up to the deleted item's parent node. How can I change this so it jumps to the next item instead? EDIT: I updated my code with Aviad's suggestion. Here is my code.. public class ModifiedTreeView : TreeView { protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) { base.OnItemsChanged(e); if (e.Action == NotifyCollectionChangedAction.Remove) { if (e.OldStartingIndex - 1 > 0) {

Confused about CollectionViewSource (SelectedItem not working in combos)

空扰寡人 提交于 2019-12-02 00:18:15
问题 I have a bunch of combos that all share the same available choices. These choices are provided in a collection exposed from my ViewModel. All fine and dandy. I now want these choices sorted, so I decided to expose an ICollectionView from my ViewModel instead of my usual ReadonlyObservableCollection<T> , and sort the collection view in my ViewModel. class EditStuffViewModel : ViewModelBase { public EditStuffViewModel (ObservableCollection<Choice> choices) { Choices = new CollectionViewSource()

Incorrect selection of items in an FMX TListbox (Grid Metropolis UI)

末鹿安然 提交于 2019-12-01 23:01:01
I have met an issue of unproper selection of items in TListBox in my application with a HorzScrollBox in the form. The form has two (or more) TListBox on it. They are placed away from each other so that their absolute left coordinates difference is more than the width of the current device screen width. The error appears in the following sequence of user actions. An item is selected from the left TListBox The HorzScrollBox is scrolled to the right and the second TListBox becomes visible to user and the left one - invisible. The HorzScrollBox is scrolled back to the left. An new item is

Synchronizing a SelectedPath property with the SelectedItem in WPF's TreeView

半腔热情 提交于 2019-12-01 21:39:07
I am trying to create a SelectedPath property (e.g. in my view-model) that is synchronized with a WPF TreeView . The theory is as follows: Whenever the selected item in the tree view is changed ( SelectedItem property/ SelectedItemChanged event), update the SelectedPath property to store a string that represents the whole path to the selected tree node. Whenever the SelectedPath property is changed, find the tree node indicated by the path string, expand the whole path to that tree node, and select it, after de-selecting the previously selected node. In order to make all of this reproducible,

WPF: Listbox, centering selected item

爱⌒轻易说出口 提交于 2019-12-01 20:33:12
Is it possible to always keep selected item in the middle of a listbox? If the user selects an item, I want to scroll so that the newly selected item is in the middle. I guess it want be possible for the 'edge cases' (the first and last few items), but that's ok. David Anson posted some articles on his blog that might help you here: Part 1 and Part 2 . He gives an extension method that centers an item in an List Box. You might be able to build on that. It is possible with couple of lines of custom code. Here's a discussion of a sample implementation . You might need to tweak it a bit to