WPF - reset ListBox scroll position when ItemsSource changes

前端 未结 5 2390
有刺的猬
有刺的猬 2021-02-18 23:41

I currently have a ListBox whose ItemsSource collection is bound to a property on my viewmodel, of type IEnumerable. When that preoprty\'s reference changes, the ListBox update

5条回答
  •  误落风尘
    2021-02-19 00:25

    When you format the control, you select a range of cells as the selection choices which are then listed in the list box. You also select a cell as the link to the selected choices in which a number will be displayed depending on the position of the selection in the list. 1 for first in the list, 2 for second etc. The code is quite simply:-

    Range("A1")Select

    Selection = 1

    Change ("A1") to the cell you have linked and change the 1 to the position in the list you want selected.

    The cell reference being a link works both ways - if you change your selection, the number in the cell changes and if you change the number in the cell, the highlighted selection changes.

提交回复
热议问题