Files
Artemis/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeViewModel.cs
T
Robert 3e75f200f4 Core - Streamlined public parts of profile creation
UI - Started adjusting the VMs for the layer refactor
2020-09-12 10:39:44 +02:00

36 lines
1.3 KiB
C#

using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
{
public class TreeViewModel : Screen
{
public TreeViewModel(LayerPropertiesViewModel layerPropertiesViewModel, BindableCollection<LayerPropertyGroupViewModel> layerPropertyGroups)
{
LayerPropertiesViewModel = layerPropertiesViewModel;
// Not using the Items collection because the list should persist even after this VM gets closed
LayerPropertyGroups = layerPropertyGroups;
}
public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; }
public void PropertyTreePreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Handled || !(sender is System.Windows.Controls.TreeView))
return;
e.Handled = true;
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
{
RoutedEvent = UIElement.MouseWheelEvent,
Source = sender
};
var parent = ((Control) sender).Parent as UIElement;
parent?.RaiseEvent(eventArg);
}
}
}