Event condition - Added toggle off mode

Profile editor - Added element copy/pasting
Shared UI - Fix namespaces
This commit is contained in:
Robert committed 2022-04-17 20:23:18 +02:00
1 parent 8c7bbc3f0f
commit 52f2338154
84 files changed
+1059 -608

No files matched your search

@@ -3,6 +3,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Shared.Controls.ArtemisIcon">
x:Class="Artemis.UI.Shared.ArtemisIcon">
Welcome to Avalonia!
</UserControl>
@@ -8,7 +8,7 @@ using Avalonia.Svg.Skia;
using Material.Icons;
using Material.Icons.Avalonia;
namespace Artemis.UI.Shared.Controls
namespace Artemis.UI.Shared
{
/// <summary>
/// Represents a control that can display an arbitrary kind of icon.
@@ -13,10 +13,11 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Data;
using Avalonia.Threading;
using Material.Icons.Avalonia;
using ReactiveUI;
namespace Artemis.UI.Shared.Controls.DataModelPicker;
namespace Artemis.UI.Shared.DataModelPicker;
/// <summary>
/// Represents a data model picker picker that can be used to select a data model path.
@@ -52,29 +53,32 @@ public class DataModelPicker : TemplatedControl
public static readonly StyledProperty<DataModelPropertiesViewModel?> DataModelViewModelProperty =
AvaloniaProperty.Register<DataModelPicker, DataModelPropertiesViewModel?>(nameof(DataModelViewModel));
/// <summary>
/// A list of data model view models to show
/// </summary>
public static readonly StyledProperty<ObservableCollection<DataModelPropertiesViewModel>?> ExtraDataModelViewModelsProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<DataModelPropertiesViewModel>?>(nameof(ExtraDataModelViewModels), new ObservableCollection<DataModelPropertiesViewModel>());
/// <summary>
/// A list of types to filter the selectable paths on.
/// </summary>
public static readonly StyledProperty<ObservableCollection<Type>?> FilterTypesProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Type>?>(nameof(FilterTypes), new ObservableCollection<Type>());
private MaterialIcon? _currentPathIcon;
private TextBlock? _currentPathDisplay;
/// <summary>
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
/// When <see langword="true" /> event children aren't selectable and non-events are described as "{PropertyName}
/// changed".
/// </summary>
public static readonly StyledProperty<bool> IsEventPickerProperty =
AvaloniaProperty.Register<DataModelPicker, bool>(nameof(IsEventPicker));
private TextBlock? _currentPathDescription;
private TextBlock? _currentPathDisplay;
private MaterialIcon? _currentPathIcon;
private TreeView? _dataModelTreeView;
private DispatcherTimer? _updateTimer;
static DataModelPicker()
{
ModulesProperty.Changed.Subscribe(ModulesChanged);
DataModelPathProperty.Changed.Subscribe(DataModelPathPropertyChanged);
DataModelViewModelProperty.Changed.Subscribe(DataModelViewModelPropertyChanged);
ExtraDataModelViewModelsProperty.Changed.Subscribe(ExtraDataModelViewModelsChanged);
}
/// <summary>
@@ -125,16 +129,7 @@ public class DataModelPicker : TemplatedControl
get => GetValue(DataModelViewModelProperty);
private set => SetValue(DataModelViewModelProperty, value);
}
/// <summary>
/// A list of data model view models to show.
/// </summary>
public ObservableCollection<DataModelPropertiesViewModel>? ExtraDataModelViewModels
{
get => GetValue(ExtraDataModelViewModelsProperty);
set => SetValue(ExtraDataModelViewModelsProperty, value);
}
/// <summary>
/// A list of types to filter the selectable paths on.
/// </summary>
@@ -144,6 +139,17 @@ public class DataModelPicker : TemplatedControl
set => SetValue(FilterTypesProperty, value);
}
/// <summary>
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
/// When <see langword="true" /> event children aren't selectable and non-events are described as "{PropertyName}
/// changed".
/// </summary>
public bool IsEventPicker
{
get => GetValue(IsEventPickerProperty);
set => SetValue(IsEventPickerProperty, value);
}
/// <summary>
/// Occurs when a new path has been selected
/// </summary>
@@ -158,42 +164,6 @@ public class DataModelPicker : TemplatedControl
DataModelPathSelected?.Invoke(this, e);
}
#region Overrides of TemplatedControl
/// <inheritdoc />
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
if (_dataModelTreeView != null)
_dataModelTreeView.SelectionChanged -= DataModelTreeViewOnSelectionChanged;
_currentPathIcon = e.NameScope.Find<MaterialIcon>("CurrentPathIcon");
_currentPathDisplay = e.NameScope.Find<TextBlock>("CurrentPathDisplay");
_currentPathDescription = e.NameScope.Find<TextBlock>("CurrentPathDescription");
_dataModelTreeView = e.NameScope.Find<TreeView>("DataModelTreeView");
if (_dataModelTreeView != null)
_dataModelTreeView.SelectionChanged += DataModelTreeViewOnSelectionChanged;
}
#region Overrides of Visual
/// <inheritdoc />
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
GetDataModel();
UpdateCurrentPath(true);
}
/// <inheritdoc />
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
DataModelViewModel?.Dispose();
}
#endregion
#endregion
private static void ModulesChanged(AvaloniaPropertyChangedEventArgs<ObservableCollection<Module>?> e)
{
if (e.Sender is DataModelPicker dataModelPicker)
@@ -212,11 +182,6 @@ public class DataModelPicker : TemplatedControl
e.OldValue.Value.Dispose();
}
private static void ExtraDataModelViewModelsChanged(AvaloniaPropertyChangedEventArgs<ObservableCollection<DataModelPropertiesViewModel>?> e)
{
// TODO, the original did nothing here either and I can't remember why
}
private void ExecuteSelectPropertyCommand(DataModelVisualizationViewModel selected)
{
if (selected.DataModelPath == null)
@@ -228,6 +193,14 @@ public class DataModelPicker : TemplatedControl
OnDataModelPathSelected(new DataModelSelectedEventArgs(DataModelPath));
}
private void Update(object? sender, EventArgs e)
{
if (DataModelUIService == null)
return;
DataModelViewModel?.Update(DataModelUIService, new DataModelUpdateConfiguration(!IsEventPicker));
}
private void GetDataModel()
{
if (DataModelUIService == null)
@@ -251,10 +224,11 @@ public class DataModelPicker : TemplatedControl
private void DataModelOnUpdateRequested(object? sender, EventArgs e)
{
DataModelViewModel?.ApplyTypeFilter(true, FilterTypes?.ToArray() ?? Type.EmptyTypes);
if (ExtraDataModelViewModels == null) return;
foreach (DataModelPropertiesViewModel extraDataModelViewModel in ExtraDataModelViewModels)
extraDataModelViewModel.ApplyTypeFilter(true, FilterTypes?.ToArray() ?? Type.EmptyTypes);
if (DataModelUIService == null || DataModelViewModel == null)
return;
DataModelViewModel.Update(DataModelUIService, new DataModelUpdateConfiguration(IsEventPicker));
DataModelViewModel.ApplyTypeFilter(true, FilterTypes?.ToArray() ?? Type.EmptyTypes);
}
private void DataModelTreeViewOnSelectionChanged(object? sender, SelectionChangedEventArgs e)
@@ -295,6 +269,45 @@ public class DataModelPicker : TemplatedControl
_currentPathDescription.Text = DataModelPath.GetPropertyDescription()?.Description;
if (_currentPathIcon != null)
_currentPathIcon.Kind = DataModelPath.GetPropertyType().GetTypeIcon();
}
#region Overrides of TemplatedControl
/// <inheritdoc />
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
if (_dataModelTreeView != null)
_dataModelTreeView.SelectionChanged -= DataModelTreeViewOnSelectionChanged;
_currentPathIcon = e.NameScope.Find<MaterialIcon>("CurrentPathIcon");
_currentPathDisplay = e.NameScope.Find<TextBlock>("CurrentPathDisplay");
_currentPathDescription = e.NameScope.Find<TextBlock>("CurrentPathDescription");
_dataModelTreeView = e.NameScope.Find<TreeView>("DataModelTreeView");
if (_dataModelTreeView != null)
_dataModelTreeView.SelectionChanged += DataModelTreeViewOnSelectionChanged;
}
#region Overrides of Visual
/// <inheritdoc />
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
GetDataModel();
UpdateCurrentPath(true);
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Normal, Update);
_updateTimer.Start();
}
/// <inheritdoc />
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
DataModelViewModel?.Dispose();
_updateTimer?.Stop();
_updateTimer = null;
}
#endregion
#endregion
}
@@ -3,8 +3,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core;
using Artemis.Core.Modules;
using Artemis.UI.Shared.Controls.Flyouts;
using Artemis.UI.Shared.DataModelVisualization.Shared;
using Artemis.UI.Shared.Flyouts;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
@@ -13,7 +12,7 @@ using Avalonia.Interactivity;
using Avalonia.Threading;
using FluentAvalonia.Core;
namespace Artemis.UI.Shared.Controls.DataModelPicker;
namespace Artemis.UI.Shared.DataModelPicker;
/// <summary>
/// Represents a button that can be used to pick a data model path in a flyout.
@@ -68,18 +67,20 @@ public class DataModelPickerButton : TemplatedControl
public static readonly StyledProperty<ObservableCollection<Module>?> ModulesProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Module>?>(nameof(Modules), new ObservableCollection<Module>());
/// <summary>
/// A list of data model view models to show
/// </summary>
public static readonly StyledProperty<ObservableCollection<DataModelPropertiesViewModel>?> ExtraDataModelViewModelsProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<DataModelPropertiesViewModel>?>(nameof(ExtraDataModelViewModels), new ObservableCollection<DataModelPropertiesViewModel>());
/// <summary>
/// A list of types to filter the selectable paths on.
/// </summary>
public static readonly StyledProperty<ObservableCollection<Type>?> FilterTypesProperty =
AvaloniaProperty.Register<DataModelPicker, ObservableCollection<Type>?>(nameof(FilterTypes), new ObservableCollection<Type>());
/// <summary>
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
/// When <see langword="true" /> event children aren't selectable and non-events are described as "{PropertyName}
/// changed".
/// </summary>
public static readonly StyledProperty<bool> IsEventPickerProperty =
AvaloniaProperty.Register<DataModelPicker, bool>(nameof(IsEventPicker));
private bool _attached;
private bool _flyoutActive;
private Button? _button;
@@ -165,15 +166,6 @@ public class DataModelPickerButton : TemplatedControl
set => SetValue(ModulesProperty, value);
}
/// <summary>
/// A list of data model view models to show.
/// </summary>
public ObservableCollection<DataModelPropertiesViewModel>? ExtraDataModelViewModels
{
get => GetValue(ExtraDataModelViewModelsProperty);
set => SetValue(ExtraDataModelViewModelsProperty, value);
}
/// <summary>
/// A list of types to filter the selectable paths on.
/// </summary>
@@ -183,6 +175,17 @@ public class DataModelPickerButton : TemplatedControl
set => SetValue(FilterTypesProperty, value);
}
/// <summary>
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
/// When <see langword="true" /> event children aren't selectable and non-events are described as "{PropertyName}
/// changed".
/// </summary>
public bool IsEventPicker
{
get => GetValue(IsEventPickerProperty);
set => SetValue(IsEventPickerProperty, value);
}
/// <summary>
/// Raised when the flyout opens.
/// </summary>
@@ -239,14 +242,24 @@ public class DataModelPickerButton : TemplatedControl
}
else
{
// If a valid path is selected, gather all its segments and create a visual representation of the path
string? formattedPath = null;
if (DataModelPath != null && DataModelPath.IsValid)
formattedPath = string.Join(" › ", DataModelPath.Segments.Where(s => s.GetPropertyDescription() != null).Select(s => s.GetPropertyDescription()!.Name));
// Always show the full path in the tooltip
ToolTip.SetTip(_button, formattedPath);
_label.Text = ShowFullPath
// Reuse the tooltip value when showing the full path, otherwise only show the last segment
string? labelText = ShowFullPath
? formattedPath
: DataModelPath?.Segments.LastOrDefault()?.GetPropertyDescription()?.Name ?? DataModelPath?.Segments.LastOrDefault()?.Identifier;
// Add "changed" to the end of the display value if this is an event picker but no event was picked
if (IsEventPicker && labelText != null && DataModelPath?.GetPropertyType()?.IsAssignableTo(typeof(IDataModelEvent)) == false)
labelText += " changed";
_label.Text = labelText ?? Placeholder;
}
}
@@ -257,8 +270,8 @@ public class DataModelPickerButton : TemplatedControl
// Logic here is taken from Fluent Avalonia's ColorPicker which also reuses the same control since it's large
_flyout.DataModelPicker.DataModelPath = DataModelPath;
_flyout.DataModelPicker.ExtraDataModelViewModels = ExtraDataModelViewModels;
_flyout.DataModelPicker.FilterTypes = FilterTypes;
_flyout.DataModelPicker.IsEventPicker = IsEventPicker;
_flyout.DataModelPicker.Modules = Modules;
_flyout.DataModelPicker.ShowDataModelValues = ShowDataModelValues;
@@ -18,7 +18,7 @@ using Avalonia.Rendering;
using Avalonia.Threading;
using Avalonia.Visuals.Media.Imaging;
namespace Artemis.UI.Shared.Controls
namespace Artemis.UI.Shared
{
/// <summary>
/// Visualizes an <see cref="ArtemisDevice" /> with optional per-LED colors
@@ -11,7 +11,7 @@ using Color = Avalonia.Media.Color;
using Point = Avalonia.Point;
using SolidColorBrush = Avalonia.Media.SolidColorBrush;
namespace Artemis.UI.Shared.Controls
namespace Artemis.UI.Shared
{
internal class DeviceVisualizerLed
{
@@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Shared.Controls.EnumComboBox">
x:Class="Artemis.UI.Shared.EnumComboBox">
<ComboBox x:Name="EnumComboBox" HorizontalAlignment="Stretch">
<ComboBox.ItemTemplate>
<DataTemplate>
@@ -8,7 +8,7 @@ using Avalonia.Data;
using Avalonia.LogicalTree;
using Avalonia.Markup.Xaml;
namespace Artemis.UI.Shared.Controls
namespace Artemis.UI.Shared
{
/// <summary>
/// Represents a combobox that can display the values of an enum.
@@ -5,7 +5,7 @@ using FluentAvalonia.Core;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Controls.Primitives;
namespace Artemis.UI.Shared.Controls.Flyouts;
namespace Artemis.UI.Shared.Flyouts;
/// <summary>
/// Defines a flyout that hosts a data model picker.
@@ -1,6 +1,6 @@
using Avalonia.Controls;
namespace Artemis.UI.Shared.Controls.Flyouts;
namespace Artemis.UI.Shared.Flyouts;
/// <summary>
/// Defines a flyout that hosts a gradient picker.
@@ -16,7 +16,7 @@ using FluentAvalonia.UI.Media;
using ReactiveUI;
using Button = Avalonia.Controls.Button;
namespace Artemis.UI.Shared.Controls.GradientPicker;
namespace Artemis.UI.Shared.GradientPicker;
/// <summary>
/// Represents a gradient picker that can be used to edit a gradient.
@@ -2,7 +2,7 @@
using System.Collections.Specialized;
using System.Linq;
using Artemis.Core;
using Artemis.UI.Shared.Controls.Flyouts;
using Artemis.UI.Shared.Flyouts;
using Artemis.UI.Shared.Providers;
using Avalonia;
using Avalonia.Controls;
@@ -13,7 +13,7 @@ using Avalonia.Media;
using FluentAvalonia.Core;
using Button = FluentAvalonia.UI.Controls.Button;
namespace Artemis.UI.Shared.Controls.GradientPicker;
namespace Artemis.UI.Shared.GradientPicker;
/// <summary>
/// Represents a gradient picker box that can be used to edit a gradient
@@ -2,11 +2,10 @@
using Artemis.Core;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
namespace Artemis.UI.Shared.Controls.GradientPicker;
namespace Artemis.UI.Shared.GradientPicker;
public class GradientPickerColorStop : TemplatedControl
{
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls"
xmlns:shared="clr-namespace:Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Shared.Controls.HotkeyBox">
x:Class="Artemis.UI.Shared.HotkeyBox">
<UserControl.Styles>
<Style Selector="TextBox#DisplayTextBox:focus:not(TextBox:empty)">
@@ -17,7 +17,7 @@
</Style>
</UserControl.Styles>
<controls:NoInputTextBox x:Name="DisplayTextBox"
<shared:NoInputTextBox x:Name="DisplayTextBox"
Watermark="{Binding $parent.Watermark}"
UseFloatingWatermark="{Binding $parent.UseFloatingWatermark}"
Classes="clearButton"
@@ -11,7 +11,7 @@ using Avalonia.Markup.Xaml;
using Humanizer;
using Material.Icons;
namespace Artemis.UI.Shared.Controls
namespace Artemis.UI.Shared
{
/// <summary>
/// Represents a control that can be used to display or edit <see cref="Core.Hotkey"/> instances.
@@ -3,7 +3,7 @@ using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Styling;
namespace Artemis.UI.Shared.Controls
namespace Artemis.UI.Shared
{
internal class NoInputTextBox : TextBox, IStyleable
{
@@ -3,5 +3,5 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Shared.Controls.ProfileConfigurationIcon">
x:Class="Artemis.UI.Shared.ProfileConfigurationIcon">
</UserControl>
@@ -10,7 +10,7 @@ using Avalonia.Svg.Skia;
using Material.Icons;
using Material.Icons.Avalonia;
namespace Artemis.UI.Shared.Controls
namespace Artemis.UI.Shared
{
/// <summary>
/// Represents a control that can display the icon of a specific <see cref="ProfileConfiguration"/>.
@@ -6,7 +6,7 @@ using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
namespace Artemis.UI.Shared.Controls;
namespace Artemis.UI.Shared;
/// <summary>
/// Visualizes an <see cref="ArtemisDevice" /> with optional per-LED colors
@@ -1,6 +1,5 @@
using System;
using Artemis.Core;
using Artemis.UI.Shared.Controls;
namespace Artemis.UI.Shared.Events
{
@@ -1,5 +1,4 @@
using System;
using Artemis.UI.Shared.Controls;
using Avalonia;
using Avalonia.Input;
@@ -0,0 +1,38 @@
using Artemis.Core;
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
/// <summary>
/// Represents a profile editor command that can be used to update an event condition's overlap mode.
/// </summary>
public class UpdateEventToggleOffMode : IProfileEditorCommand
{
private readonly EventCondition _eventCondition;
private readonly EventToggleOffMode _value;
private readonly EventToggleOffMode _oldValue;
/// <summary>
/// Creates a new instance of the <see cref="UpdateEventOverlapMode" /> class.
/// </summary>
public UpdateEventToggleOffMode(EventCondition eventCondition, EventToggleOffMode value)
{
_eventCondition = eventCondition;
_value = value;
_oldValue = eventCondition.ToggleOffMode;
}
/// <inheritdoc />
public string DisplayName => "Update event toggle off mode";
/// <inheritdoc />
public void Execute()
{
_eventCondition.ToggleOffMode = _value;
}
/// <inheritdoc />
public void Undo()
{
_eventCondition.ToggleOffMode = _oldValue;
}
}
+3 -3
View File
@@ -1,9 +1,9 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:controls1="clr-namespace:Artemis.UI.Shared.Controls"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker"
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.Controls.DataModelPicker">
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker"
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker"
xmlns:controls1="clr-namespace:Artemis.UI.Shared">
<Design.PreviewWith>
<Border Padding="50">
<StackPanel Spacing="5">
@@ -1,9 +1,9 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dataModel="clr-namespace:Artemis.UI.Shared.DataModelVisualization.Shared"
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.Controls.DataModelPicker"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia">
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker">
<Design.PreviewWith>
<dataModelPicker:DataModelPicker />
</Design.PreviewWith>
@@ -20,7 +20,22 @@
RowDefinitions="*"
MinHeight="38"
IsVisible="{Binding DataModelPath, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}">
<avalonia:MaterialIcon Grid.Column="0" Grid.Row="0" Name="CurrentPathIcon" Kind="QuestionMarkCircle" Height="22" Width="22" Margin="5 0 15 0" />
<avalonia:MaterialIcon Grid.Column="0"
Grid.Row="0"
Name="CurrentPathIcon"
Kind="QuestionMarkCircle"
Height="22"
Width="22"
Margin="5 0 15 0"
IsVisible="{Binding !IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/>
<avalonia:MaterialIcon Grid.Column="0"
Grid.Row="0"
Name="EventIcon"
Kind="LightningBolt"
Height="22"
Width="22"
Margin="5 0 15 0"
IsVisible="{Binding IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/>
<StackPanel Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
<TextBlock Name="CurrentPathDisplay" Classes="BodyStrongTextBlockStyle" MaxHeight="50" />
<TextBlock Name="CurrentPathDescription" Classes="BodyTextBlockStyle" Foreground="{DynamicResource TextFillColorSecondary}" MaxHeight="50" />
@@ -42,6 +57,7 @@
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes, Mode=OneWay}" />
</Style>
</TreeView.Styles>
<TreeView.DataTemplates>
@@ -58,7 +74,13 @@
<TreeDataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
<Grid ColumnDefinitions="Auto,*">
<TextBlock Grid.Column="0" Text="{Binding PropertyDescription.Name}" ToolTip.Tip="{Binding PropertyDescription.Description}" />
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding PropertyDescription.Name}" ToolTip.Tip="{Binding PropertyDescription.Description}" />
<TextBlock Text=" changed"
ToolTip.Tip="{Binding PropertyDescription.Description}"
IsVisible="{Binding IsEventPicker, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type dataModelPicker:DataModelPicker}}}"/>
</StackPanel>
<ContentControl Grid.Column="1" Content="{Binding DisplayViewModel}" FontFamily="Consolas" Margin="0 0 10 0" />
</Grid>
</TreeDataTemplate>
@@ -1,8 +1,8 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.Controls.DataModelPicker"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker">
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker">
<Design.PreviewWith>
<Border Padding="20" Width="200">
<StackPanel Spacing="5">
@@ -1,10 +1,10 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Artemis.UI.Shared.Controls.GradientPicker"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core"
xmlns:fluent="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:converters="clr-namespace:Artemis.UI.Shared.Converters">
xmlns:converters="clr-namespace:Artemis.UI.Shared.Converters"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker">
<Styles.Resources>
<VisualBrush x:Key="LightCheckerboardBrush" TileMode="Tile" Stretch="Uniform" DestinationRect="3,0,10,10">
<VisualBrush.Visual>
@@ -18,10 +18,10 @@
</VisualBrush>
</Styles.Resources>
<Design.PreviewWith>
<controls:GradientPicker />
<gradientPicker:GradientPicker />
</Design.PreviewWith>
<Style Selector="controls|GradientPickerColorStop /template/ Border.stop-handle">
<Style Selector="gradientPicker|GradientPickerColorStop /template/ Border.stop-handle">
<Setter Property="CornerRadius" Value="18" />
<Setter Property="Width" Value="18" />
<Setter Property="Height" Value="60" />
@@ -30,32 +30,32 @@
<Setter Property="BorderBrush" Value="{DynamicResource ToolTipBorderBrush}" />
<Setter Property="Cursor" Value="Hand" />
</Style>
<Style Selector="controls|GradientPickerColorStop /template/ Border.stop-handle > Border">
<Style Selector="gradientPicker|GradientPickerColorStop /template/ Border.stop-handle > Border">
<Setter Property="CornerRadius" Value="18" />
<Setter Property="BorderThickness" Value="3" />
<Setter Property="BorderBrush" Value="{DynamicResource SolidBackgroundFillColorQuarternaryBrush}" />
<Setter Property="Background" Value="{DynamicResource LightCheckerboardBrush}" />
</Style>
<Style Selector="controls|GradientPickerColorStop /template/ Border.stop-handle > Border > Border">
<Style Selector="gradientPicker|GradientPickerColorStop /template/ Border.stop-handle > Border > Border">
<Setter Property="CornerRadius" Value="18" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Margin" Value="-1" />
<Setter Property="BorderBrush" Value="{DynamicResource SolidBackgroundFillColorSecondaryBrush}" />
</Style>
<Style Selector="controls|GradientPickerColorStop:selected /template/ Border.stop-handle > Border">
<Style Selector="gradientPicker|GradientPickerColorStop:selected /template/ Border.stop-handle > Border">
<Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColorLight2}" />
</Style>
<Style Selector="controls|GradientPicker Border#Gradient">
<Style Selector="gradientPicker|GradientPicker Border#Gradient">
<Setter Property="Height" Value="40" />
<Setter Property="CornerRadius" Value="4" />
</Style>
<Style Selector="controls|GradientPicker Border#Gradient Border">
<Style Selector="gradientPicker|GradientPicker Border#Gradient Border">
<Setter Property="CornerRadius" Value="4" />
</Style>
<Style Selector="controls|GradientPicker Border.stop-position">
<Style Selector="gradientPicker|GradientPicker Border.stop-position">
<Setter Property="Background" Value="{DynamicResource SolidBackgroundFillColorBaseBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
@@ -65,12 +65,12 @@
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
</Style>
<Style Selector="controls|GradientPicker Border.stop-position TextBlock">
<Style Selector="gradientPicker|GradientPicker Border.stop-position TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style Selector="controls|GradientPicker">
<Style Selector="gradientPicker|GradientPicker">
<Style.Resources>
<converters:ColorGradientToGradientStopsConverter x:Key="ColorGradientToGradientStopsConverter" />
<converters:SKColorToColorConverter x:Key="SKColorToColorConverter" />
@@ -103,11 +103,11 @@
</ItemsControl.Styles>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="core:ColorGradientStop">
<controls:GradientPickerColorStop ColorStop="{Binding}"
<gradientPicker:GradientPickerColorStop ColorStop="{Binding}"
PositionReference="{Binding $parent[Border]}"
Classes="gradient-handle"
GradientPicker="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:GradientPicker}}}">
</controls:GradientPickerColorStop>
GradientPicker="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gradientPicker:GradientPicker}}}">
</gradientPicker:GradientPickerColorStop>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
@@ -202,7 +202,7 @@
<Button Name="DeleteButton"
Grid.Column="3"
Classes="icon-button"
Command="{Binding DeleteStop, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:GradientPicker}}}"
Command="{Binding DeleteStop, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gradientPicker:GradientPicker}}}"
CommandParameter="{Binding}">
<avalonia:MaterialIcon Kind="Close" />
</Button>
@@ -247,7 +247,7 @@
</Setter>
</Style>
<Style Selector="controls|GradientPickerColorStop.gradient-handle">
<Style Selector="gradientPicker|GradientPickerColorStop.gradient-handle">
<Style.Resources>
<converters:SKColorToBrushConverter x:Key="SKColorToBrushConverter" />
</Style.Resources>
@@ -1,7 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia">
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker">
<Design.PreviewWith>
<Border Padding="20" Width="200">
<StackPanel Spacing="5">
+5 -1
View File
@@ -32,7 +32,7 @@
<TreeViewItem Header="SubItem Item3" />
</TreeViewItem>
</TreeViewItem>
<TreeViewItem Header="Item3" />
<TreeViewItem Header="Item3" IsEnabled="False"/>
<TreeViewItem Header="Item4" />
</TreeView>
</Border>
@@ -94,6 +94,10 @@
<Setter Property="Margin" Value="0"></Setter>
</Style>
<Style Selector="TreeView TreeViewItem[IsEnabled=False]">
<Setter Property="Foreground" Value="{DynamicResource ButtonDisabledForegroundThemeBrush}"/>
</Style>
<!-- <Style Selector="TreeView.no-right-margin TreeViewItem /template/ Border#TreeViewItemLayoutRoot"> -->
<!-- <Setter Property="Margin" Value="2 2 0 2"/> -->
<!-- </Style> -->