This project is read-only.

ModernTab List UpdateSelection, Scroll to selected Item (Solution)

Nov 22, 2014 at 10:09 PM
Edited Feb 28, 2015 at 10:21 AM
Hi All,

When you select an item programmatically in the list, and this item is not visible, you can change the ModernTab.cs file.
If it can help someone, below the code.

ModernTab.cs ( FirstFloor.ModernUI.Windows.Controls)
    private void UpdateSelection()
    {
        if (linkList == null || Links == null)
        {
            return;
        }

        // sync list selection with current source
        linkList.SelectedItem = Links.FirstOrDefault(l => l.Source == SelectedSource);
/ CODE ADDED /
        // scroll to selected item
        if (linkList.SelectedItem != null)
        linkList.ScrollIntoView(item: linkList.SelectedItem);
/ END CODE ADDED /
    }