Project - Cleaned up some test code

UI - Added scaffolding for databindings
This commit is contained in:
Robert committed 2020-08-28 13:01:52 +02:00
1 parent 47ba6fcf5e
commit 9e4ae9bbe1
28 files changed
+437 -453

No files matched your search

@@ -45,15 +45,15 @@
</Style>
</ContentControl.Resources>
</ContentControl>
<Button Grid.Column="3"
Style="{StaticResource MaterialDesignIconButton}"
ToolTip="Change the property's data binding"
Width="24"
Height="24"
VerticalAlignment="Center"
Command="{s:Action OpenDataBindings}">
<materialDesign:PackIcon Kind="VectorLink" Height="16" Width="16" />
</Button>
<ToggleButton Grid.Column="3"
Style="{StaticResource MaterialDesignFlatPrimaryToggleButton}"
ToolTip="Change the property's data binding"
Width="20"
Height="20"
VerticalAlignment="Center"
IsChecked="{Binding DataBindingsOpen}">
<materialDesign:PackIcon Kind="VectorLink" Height="13" Width="13" />
</ToggleButton>
</Grid>
</UserControl>
@@ -9,7 +9,6 @@ using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
{
public class TreePropertyViewModel<T> : TreePropertyViewModel
{
private readonly IProfileEditorService _profileEditorService;
@@ -21,6 +20,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
_profileEditorService = profileEditorService;
LayerPropertyViewModel = (LayerPropertyViewModel<T>) layerPropertyBaseViewModel;
PropertyInputViewModel = propertyInputViewModel;
_profileEditorService.SelectedDataBindingChanged += ProfileEditorServiceOnSelectedDataBindingChanged;
}
public LayerPropertyViewModel<T> LayerPropertyViewModel { get; }
@@ -37,9 +38,10 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
set => ApplyKeyframesEnabled(value);
}
public void OpenDataBindings()
public bool DataBindingsOpen
{
_profileEditorService.ChangeSelectedDataBinding(LayerPropertyViewModel.BaseLayerProperty);
get => _profileEditorService.SelectedDataBinding == LayerPropertyViewModel.BaseLayerProperty;
set => _profileEditorService.ChangeSelectedDataBinding(value ? LayerPropertyViewModel.BaseLayerProperty : null);
}
public override void Dispose()
@@ -47,6 +49,11 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
PropertyInputViewModel.Dispose();
}
private void ProfileEditorServiceOnSelectedDataBindingChanged(object sender, EventArgs e)
{
NotifyOfPropertyChange(nameof(DataBindingsOpen));
}
private void ApplyKeyframesEnabled(bool enable)
{
// If enabling keyframes for the first time, add a keyframe with the current value at the current position
@@ -77,6 +84,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
}
public LayerPropertyBaseViewModel LayerPropertyBaseViewModel { get; }
public abstract void Dispose();
}
}