mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-10-02 10:07:15 +13:00
Fix offset calculation for sub menus when filters are active
This commit is contained in:
parent
2afd604606
commit
09100cf821
1 changed files with 8 additions and 1 deletions
|
@ -715,7 +715,7 @@ namespace SystemTrayMenu.UserInterface
|
||||||
// Set position on same height as the selected row from predecessor
|
// Set position on same height as the selected row from predecessor
|
||||||
ListView dgv = menuPredecessor.GetDataGridView()!;
|
ListView dgv = menuPredecessor.GetDataGridView()!;
|
||||||
RowData? trigger = RowDataParent;
|
RowData? trigger = RowDataParent;
|
||||||
if (trigger != null && dgv.Items.Count > trigger.RowIndex)
|
if (trigger != null)
|
||||||
{
|
{
|
||||||
// When scrolled, we have to reduce the index number as we calculate based on visual tree
|
// When scrolled, we have to reduce the index number as we calculate based on visual tree
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
|
@ -740,11 +740,18 @@ namespace SystemTrayMenu.UserInterface
|
||||||
if (startIndex < trigger.RowIndex)
|
if (startIndex < trigger.RowIndex)
|
||||||
{
|
{
|
||||||
// calculate position below starting point
|
// calculate position below starting point
|
||||||
|
// outer loop check for max RowIndex, independend of currently active filter
|
||||||
|
// inner loop check for filtered and shown items
|
||||||
for (int i = startIndex; i < trigger.RowIndex; i++)
|
for (int i = startIndex; i < trigger.RowIndex; i++)
|
||||||
{
|
{
|
||||||
ListViewItem? item = dgv.FindVisualChildOfType<ListViewItem>(i);
|
ListViewItem? item = dgv.FindVisualChildOfType<ListViewItem>(i);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
|
if (((RowData)item.Content).RowIndex >= trigger.RowIndex)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
offset += item.ActualHeight;
|
offset += item.ActualHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue