Datamodels - A few small fixes to fix errors during startup

Layer properties - Reimplemented property tree
Stylet - Add support for binding views to generic VMs
This commit is contained in:
SpoinkyNL committed 2020-05-17 18:54:15 +02:00
1 parent 8f639c9074
commit 2fd522bafb
22 files changed
+207 -42

No files matched your search

@@ -8,7 +8,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyI
{
public class SKPointPropertyInputViewModel : PropertyInputViewModel<SKPoint>
{
public SKPointPropertyInputViewModel(LayerPropertyViewModel<SKPoint> layerPropertyViewModel, IModelValidator validator) : base(layerPropertyViewModel, validator)
public SKPointPropertyInputViewModel(LayerPropertyViewModel<SKPoint> layerPropertyViewModel, IModelValidator<SKPointPropertyInputViewModel> validator)
: base(layerPropertyViewModel, validator)
{
}
@@ -8,7 +8,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.PropertyI
{
public class SKSizePropertyInputViewModel : PropertyInputViewModel<SKSize>
{
public SKSizePropertyInputViewModel(LayerPropertyViewModel<SKSize> layerPropertyViewModel, IModelValidator validator) : base(layerPropertyViewModel, validator)
public SKSizePropertyInputViewModel(LayerPropertyViewModel<SKSize> layerPropertyViewModel, IModelValidator<SKSizePropertyInputViewModel> validator)
: base(layerPropertyViewModel, validator)
{
}
@@ -0,0 +1,52 @@
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.TreePropertyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Height="22">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ToggleButton Grid.Column="0"
Style="{StaticResource MaterialDesignFlatToggleButton}"
ToolTip="Toggle key-framing"
Width="18"
Height="18"
IsChecked="{Binding LayerPropertyViewModel.LayerProperty.KeyframesEnabled}"
IsEnabled="{Binding LayerPropertyViewModel.LayerProperty.KeyframesSupported}"
VerticalAlignment="Center" Padding="-25">
<materialDesign:PackIcon Kind="Stopwatch" Height="13" Width="13" />
</ToggleButton>
<TextBlock Grid.Column="1"
Margin="5,0,0,0"
Padding="0,0,5,0"
VerticalAlignment="Center"
TextTrimming="CharacterEllipsis"
Text="{Binding LayerPropertyViewModel.PropertyDescription.Name}"
ToolTip="{Binding LayerPropertyViewModel.PropertyDescription.Description}"
HorizontalAlignment="Left" />
<ContentControl Grid.Column="2" Margin="20 0" s:View.Model="{Binding PropertyInputViewModel}" />
<Button Grid.Column="3"
Style="{StaticResource MaterialDesignOutlinedButton}"
Margin="0,1,0,1.2"
Padding="0"
Width="80"
Height="20"
ToolTip="Change the property's data binding"
VerticalAlignment="Center"
IsEnabled="False">
<TextBlock FontSize="10">DATA BINDING</TextBlock>
</Button>
</Grid>
</UserControl>
@@ -30,9 +30,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
public LayerPropertyBaseViewModel LayerPropertyBaseViewModel { get; }
public abstract void Dispose();
public static void RegisterPropertyInputViewModel()
{
}
}
}
@@ -103,9 +103,7 @@
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type layerProperties:LayerPropertyViewModel}">
<!-- <ContentControl s:View.Model="{Binding TreePropertyBaseViewModel}" /> -->
<TextBlock Text="{Binding PropertyDescription.Name}"
ToolTip="{Binding PropertyDescription.Description}" Margin="5 0" VerticalAlignment="Center" />
<ContentControl s:View.Model="{Binding TreePropertyBaseViewModel}" />
</DataTemplate>
</TreeView.Resources>
</TreeView>
@@ -1,4 +1,7 @@
using Stylet;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Stylet;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
{
@@ -10,5 +13,20 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
}
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; }
public void PropertyTreePreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Handled || !(sender is 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);
}
}
}