mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-07-06 06:51:04 +12:00
Reintroduce hover state of list items
Items were immediately selected when mouse hovered over
This commit is contained in:
parent
569722a5b0
commit
b00092e4a5
|
@ -32,7 +32,6 @@ namespace SystemTrayMenu.Business
|
|||
{
|
||||
if (MouseActive)
|
||||
{
|
||||
MouseSelect?.Invoke(itemData);
|
||||
timerStartLoad.Stop();
|
||||
StopLoadMenu?.Invoke();
|
||||
SetData(itemData);
|
||||
|
@ -72,6 +71,7 @@ namespace SystemTrayMenu.Business
|
|||
StopLoadMenu?.Invoke();
|
||||
SetData(itemData);
|
||||
MouseActive = true;
|
||||
MouseSelect?.Invoke(itemData);
|
||||
OpenSubMenu();
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,11 @@ namespace SystemTrayMenu.Business
|
|||
{
|
||||
timerStartLoad.Stop();
|
||||
StopLoadMenu?.Invoke();
|
||||
if (MouseActive && currentItemData != null)
|
||||
{
|
||||
MouseSelect?.Invoke(currentItemData);
|
||||
}
|
||||
|
||||
OpenSubMenu();
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@
|
|||
|
||||
<ListView x:Name="dgv" x:FieldModifier="internal" Margin="6,1,6,1" Padding="0" d:ItemsSource="{d:SampleData ItemCount=50}" SelectionMode="Single" HorizontalContentAlignment="Stretch"
|
||||
Background="{x:Null}" BorderThickness="0" VirtualizingStackPanel.IsVirtualizing="False"
|
||||
SelectionChanged="ListView_SelectionChanged" MouseLeave="ListView_MouseLeave"
|
||||
SelectionChanged="ListView_SelectionChanged"
|
||||
ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.ScrollChanged="HandleScrollChanged">
|
||||
<!--ListView."Childs".Border.Padding="0" // In ctor, see: dgv_border -->
|
||||
<ListView.Resources>
|
||||
|
|
|
@ -1117,25 +1117,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
}
|
||||
}
|
||||
|
||||
private void ListView_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
// In case a sub menu is already open and another item was already selected
|
||||
// but WaitToLoadMenu hasn't take action yet
|
||||
// then we want to reset that selection, so the sub menu selection remains active only
|
||||
if (SubMenu != null)
|
||||
{
|
||||
ListView lv = (ListView)sender;
|
||||
foreach (RowData itemData in lv.Items)
|
||||
{
|
||||
if (itemData.SubMenu == SubMenu)
|
||||
{
|
||||
lv.SelectedItem = itemData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ListView_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
int count = dgv.Items.Count;
|
||||
|
|
Loading…
Reference in a new issue