mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Fixed Artemis.UI.Shared compile errors
This commit is contained in:
1 parent
1d6a30c447
commit
81e83e59f6
61 files changed
+343
-1746
No files matched your search
@@ -10,18 +10,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.18" />
|
||||
<PackageReference Include="DynamicData" Version="7.9.14" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="1.4.1" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
|
||||
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0-preview6" />
|
||||
<PackageReference Include="DynamicData" Version="7.13.1" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="2.0.0-preview6" />
|
||||
<PackageReference Include="Material.Icons.Avalonia" Version="1.1.10" />
|
||||
<PackageReference Include="ReactiveUI" Version="17.1.50" />
|
||||
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
|
||||
<PackageReference Include="ReactiveUI" Version="18.4.26" />
|
||||
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />
|
||||
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.17" />
|
||||
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
|
||||
<PackageReference Include="SkiaSharp" Version="2.88.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" />
|
||||
|
||||
@@ -15,7 +15,7 @@ public class LostFocusNumericUpDownBindingBehavior : Behavior<NumericUpDown>
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the binding.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<double> ValueProperty = AvaloniaProperty.Register<LostFocusNumericUpDownBindingBehavior, double>(
|
||||
public static readonly StyledProperty<decimal?> ValueProperty = AvaloniaProperty.Register<LostFocusNumericUpDownBindingBehavior, decimal?>(
|
||||
nameof(Value), defaultBindingMode: BindingMode.TwoWay);
|
||||
|
||||
static LostFocusNumericUpDownBindingBehavior()
|
||||
@@ -26,7 +26,7 @@ public class LostFocusNumericUpDownBindingBehavior : Behavior<NumericUpDown>
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the binding.
|
||||
/// </summary>
|
||||
public double Value
|
||||
public decimal? Value
|
||||
{
|
||||
get => GetValue(ValueProperty);
|
||||
set => SetValue(ValueProperty, value);
|
||||
|
||||
@@ -2,12 +2,12 @@ using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Visuals.Media.Imaging;
|
||||
using Material.Icons;
|
||||
using Material.Icons.Avalonia;
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace Artemis.UI.Shared;
|
||||
/// <summary>
|
||||
/// Represents a control that can display an arbitrary kind of icon.
|
||||
/// </summary>
|
||||
public class ArtemisIcon : UserControl
|
||||
public partial class ArtemisIcon : UserControl
|
||||
{
|
||||
private static readonly Regex _imageRegex = new(@"[\/.](gif|jpg|jpeg|tiff|png)$", RegexOptions.Compiled);
|
||||
private static readonly Regex ImageRegex = new(@"[\/.](gif|jpg|jpeg|tiff|png)$", RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="ArtemisIcon" /> class.
|
||||
@@ -30,12 +30,6 @@ public class ArtemisIcon : UserControl
|
||||
LayoutUpdated += OnLayoutUpdated;
|
||||
}
|
||||
|
||||
private static void IconChanging(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
if (before)
|
||||
((ArtemisIcon) sender).Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
try
|
||||
@@ -54,7 +48,7 @@ public class ArtemisIcon : UserControl
|
||||
Content = new MaterialIcon {Kind = parsedIcon, Width = Bounds.Width, Height = Bounds.Height};
|
||||
}
|
||||
// An URI pointing to an image
|
||||
else if (_imageRegex.IsMatch(iconString))
|
||||
else if (ImageRegex.IsMatch(iconString))
|
||||
{
|
||||
if (!Fill)
|
||||
Content = new Image
|
||||
@@ -66,7 +60,7 @@ public class ArtemisIcon : UserControl
|
||||
else
|
||||
Content = new Border
|
||||
{
|
||||
Background = TextBlock.GetForeground(this),
|
||||
Background = TextElement.GetForeground(this),
|
||||
VerticalAlignment = VerticalAlignment.Stretch,
|
||||
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||
OpacityMask = new ImageBrush(new Bitmap(iconString)) {BitmapInterpolationMode = BitmapInterpolationMode.MediumQuality}
|
||||
@@ -110,8 +104,7 @@ public class ArtemisIcon : UserControl
|
||||
/// Gets or sets the currently displayed icon as either a <see cref="MaterialIconKind" /> or an <see cref="Uri" />
|
||||
/// pointing to an SVG
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<object?> IconProperty =
|
||||
AvaloniaProperty.Register<ArtemisIcon, object?>(nameof(Icon), notifying: IconChanging);
|
||||
public static readonly StyledProperty<object?> IconProperty = AvaloniaProperty.Register<ArtemisIcon, object?>(nameof(Icon));
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -121,15 +114,18 @@ public class ArtemisIcon : UserControl
|
||||
public object? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(IconProperty, value);
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the
|
||||
/// theme
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<bool> FillProperty =
|
||||
AvaloniaProperty.Register<ArtemisIcon, bool>(nameof(Icon), false, notifying: IconChanging);
|
||||
public static readonly StyledProperty<bool> FillProperty = AvaloniaProperty.Register<ArtemisIcon, bool>(nameof(Icon));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the
|
||||
@@ -138,7 +134,11 @@ public class ArtemisIcon : UserControl
|
||||
public bool Fill
|
||||
{
|
||||
get => GetValue(FillProperty);
|
||||
set => SetValue(FillProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(FillProperty, value);
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -46,8 +46,8 @@ public class DataModelPickerButton : TemplatedControl
|
||||
/// <summary>
|
||||
/// Gets or sets the desired flyout placement.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<FlyoutPlacementMode> PlacementProperty =
|
||||
AvaloniaProperty.Register<FlyoutBase, FlyoutPlacementMode>(nameof(Placement));
|
||||
public static readonly StyledProperty<PlacementMode> PlacementProperty =
|
||||
AvaloniaProperty.Register<FlyoutBase, PlacementMode>(nameof(Placement));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets data model path.
|
||||
@@ -133,7 +133,7 @@ public class DataModelPickerButton : TemplatedControl
|
||||
/// <summary>
|
||||
/// Gets or sets the desired flyout placement.
|
||||
/// </summary>
|
||||
public FlyoutPlacementMode Placement
|
||||
public PlacementMode Placement
|
||||
{
|
||||
get => GetValue(PlacementProperty);
|
||||
set => SetValue(PlacementProperty, value);
|
||||
|
||||
@@ -15,7 +15,6 @@ using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Rendering;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.Visuals.Media.Imaging;
|
||||
|
||||
namespace Artemis.UI.Shared;
|
||||
|
||||
@@ -123,7 +122,7 @@ public class DeviceVisualizer : Control
|
||||
private Rect MeasureDevice()
|
||||
{
|
||||
if (Device == null)
|
||||
return Rect.Empty;
|
||||
return new Rect(0, 0, 0, 0);
|
||||
|
||||
Rect deviceRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height);
|
||||
Geometry geometry = new RectangleGeometry(deviceRect);
|
||||
@@ -171,21 +170,19 @@ public class DeviceVisualizer : Control
|
||||
/// Gets or sets the <see cref="ArtemisDevice" /> to display
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<ArtemisDevice?> DeviceProperty =
|
||||
AvaloniaProperty.Register<DeviceVisualizer, ArtemisDevice?>(nameof(Device), notifying: DeviceUpdated);
|
||||
|
||||
private static void DeviceUpdated(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
if (!before)
|
||||
((DeviceVisualizer) sender).SetupForDevice();
|
||||
}
|
||||
|
||||
AvaloniaProperty.Register<DeviceVisualizer, ArtemisDevice?>(nameof(Device));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="ArtemisDevice" /> to display
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device
|
||||
{
|
||||
get => GetValue(DeviceProperty);
|
||||
set => SetValue(DeviceProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(DeviceProperty, value);
|
||||
SetupForDevice();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -302,9 +299,9 @@ public class DeviceVisualizer : Control
|
||||
// Render 4 times the actual size of the device to make sure things look sharp when zoomed in
|
||||
RenderTargetBitmap renderTargetBitmap = new(new PixelSize((int) device.RgbDevice.ActualSize.Width * 2, (int) device.RgbDevice.ActualSize.Height * 2));
|
||||
|
||||
using IDrawingContextImpl context = renderTargetBitmap.CreateDrawingContext(new ImmediateRenderer(this));
|
||||
using DrawingContext context = renderTargetBitmap.CreateDrawingContext();
|
||||
using Bitmap bitmap = new(device.Layout.Image.LocalPath);
|
||||
context.DrawBitmap(bitmap.PlatformImpl, 1, new Rect(bitmap.Size), new Rect(renderTargetBitmap.Size), BitmapInterpolationMode.HighQuality);
|
||||
context.DrawImage(bitmap, new Rect(bitmap.Size), new Rect(renderTargetBitmap.Size), BitmapInterpolationMode.HighQuality);
|
||||
|
||||
lock (_deviceVisualizerLeds)
|
||||
{
|
||||
|
||||
@@ -4,8 +4,6 @@ using Artemis.Core;
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Visuals.Media.Imaging;
|
||||
using RGB.NET.Core;
|
||||
using Color = Avalonia.Media.Color;
|
||||
using Point = Avalonia.Point;
|
||||
@@ -40,7 +38,7 @@ internal class DeviceVisualizerLed
|
||||
public Rect LedRect { get; set; }
|
||||
public Geometry? DisplayGeometry { get; private set; }
|
||||
|
||||
public void DrawBitmap(IDrawingContextImpl drawingContext, double scale)
|
||||
public void DrawBitmap(DrawingContext drawingContext, double scale)
|
||||
{
|
||||
if (Led.Layout?.Image == null || !File.Exists(Led.Layout.Image.LocalPath))
|
||||
return;
|
||||
@@ -48,9 +46,8 @@ internal class DeviceVisualizerLed
|
||||
try
|
||||
{
|
||||
using Bitmap bitmap = new(Led.Layout.Image.LocalPath);
|
||||
drawingContext.DrawBitmap(
|
||||
bitmap.PlatformImpl,
|
||||
1,
|
||||
drawingContext.DrawImage(
|
||||
bitmap,
|
||||
new Rect(bitmap.Size),
|
||||
new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, Led.RgbLed.Size.Width * scale, Led.RgbLed.Size.Height * scale),
|
||||
BitmapInterpolationMode.HighQuality
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace Artemis.UI.Shared.Controls;
|
||||
/// <summary>
|
||||
/// Represents a number box that can be mutated by dragging over it horizontally
|
||||
/// </summary>
|
||||
public class DraggableNumberBox : UserControl
|
||||
public partial class DraggableNumberBox : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the <see cref="Value" /> property.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<double> ValueProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Value), defaultBindingMode: BindingMode.TwoWay, notifying: ValueChanged);
|
||||
public static readonly StyledProperty<double> ValueProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Value), defaultBindingMode: BindingMode.TwoWay);
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="Minimum" /> property.
|
||||
@@ -85,7 +85,11 @@ public class DraggableNumberBox : UserControl
|
||||
public double Value
|
||||
{
|
||||
get => GetValue(ValueProperty);
|
||||
set => SetValue(ValueProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(ValueProperty, value);
|
||||
SetNumberBoxValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -160,25 +164,21 @@ public class DraggableNumberBox : UserControl
|
||||
/// Occurs when the user finishes dragging over the control.
|
||||
/// </summary>
|
||||
public event TypedEventHandler<DraggableNumberBox, EventArgs>? DragFinished;
|
||||
|
||||
private static void ValueChanged(IAvaloniaObject sender, bool before)
|
||||
|
||||
private void SetNumberBoxValue(double value)
|
||||
{
|
||||
if (before)
|
||||
if (!(Math.Abs(_numberBox.Value - Value) > 0.00001))
|
||||
return;
|
||||
|
||||
DraggableNumberBox draggable = (DraggableNumberBox) sender;
|
||||
if (!(Math.Abs(draggable._numberBox.Value - draggable.Value) > 0.00001))
|
||||
return;
|
||||
|
||||
draggable._updating = true;
|
||||
draggable._numberBox.Value = draggable.Value;
|
||||
draggable._updating = false;
|
||||
_updating = true;
|
||||
_numberBox.Value = Value;
|
||||
_updating = false;
|
||||
}
|
||||
|
||||
private void HandleKeyUp(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter || e.Key == Key.Escape)
|
||||
Parent?.Focus();
|
||||
FocusManager.Instance?.Focus(Parent as IInputElement);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
@@ -211,7 +211,7 @@ public class DraggableNumberBox : UserControl
|
||||
if (!_moved)
|
||||
{
|
||||
// Let our parent take focus, it would make more sense to take focus ourselves but that hides the collider
|
||||
Parent?.Focus();
|
||||
FocusManager.Instance?.Focus(Parent as IInputElement);
|
||||
_moved = true;
|
||||
e.Pointer.Capture(this);
|
||||
DragStarted?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
@@ -13,13 +13,12 @@ namespace Artemis.UI.Shared;
|
||||
/// <summary>
|
||||
/// Represents a combobox that can display the values of an enum.
|
||||
/// </summary>
|
||||
public class EnumComboBox : UserControl
|
||||
public partial class EnumComboBox : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected value
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<object?> ValueProperty =
|
||||
AvaloniaProperty.Register<EnumComboBox, object?>(nameof(Value), defaultBindingMode: BindingMode.TwoWay, notifying: ValueChanged);
|
||||
public static readonly StyledProperty<object?> ValueProperty = AvaloniaProperty.Register<EnumComboBox, object?>(nameof(Value), defaultBindingMode: BindingMode.TwoWay);
|
||||
|
||||
private readonly ObservableCollection<(Enum, string)> _currentValues = new();
|
||||
private Type? _currentType;
|
||||
@@ -40,15 +39,11 @@ public class EnumComboBox : UserControl
|
||||
public object? Value
|
||||
{
|
||||
get => GetValue(ValueProperty);
|
||||
set => SetValue(ValueProperty, value);
|
||||
}
|
||||
|
||||
private static void ValueChanged(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
if (sender is EnumComboBox enumCombo && !before)
|
||||
set
|
||||
{
|
||||
enumCombo.UpdateValues();
|
||||
enumCombo.UpdateSelection();
|
||||
SetValue(ValueProperty, value);
|
||||
UpdateValues();
|
||||
UpdateSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GradientPicker : TemplatedControl
|
||||
/// Gets or sets the color gradient.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<ColorGradient> ColorGradientProperty =
|
||||
AvaloniaProperty.Register<GradientPicker, ColorGradient>(nameof(ColorGradient), notifying: ColorGradientChanged, defaultValue: ColorGradient.GetUnicornBarf());
|
||||
AvaloniaProperty.Register<GradientPicker, ColorGradient>(nameof(ColorGradient), defaultValue: ColorGradient.GetUnicornBarf());
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected color stop.
|
||||
@@ -45,7 +45,7 @@ public class GradientPicker : TemplatedControl
|
||||
/// Gets or sets a storage provider to use for storing and loading gradients.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<IColorGradientStorageProvider?> StorageProviderProperty =
|
||||
AvaloniaProperty.Register<GradientPicker, IColorGradientStorageProvider?>(nameof(StorageProvider), notifying: StorageProviderChanged);
|
||||
AvaloniaProperty.Register<GradientPicker, IColorGradientStorageProvider?>(nameof(StorageProvider));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the linear gradient brush representing the color gradient.
|
||||
@@ -66,7 +66,7 @@ public class GradientPicker : TemplatedControl
|
||||
AvaloniaProperty.RegisterDirect<GradientPicker, ColorGradient>(nameof(EditingColorGradient), g => g.EditingColorGradient);
|
||||
|
||||
private readonly ICommand _deleteStop;
|
||||
private ColorPicker? _colorPicker;
|
||||
private FAColorPicker? _colorPicker;
|
||||
private Button? _flipStops;
|
||||
private Border? _gradient;
|
||||
private Button? _randomize;
|
||||
@@ -102,7 +102,11 @@ public class GradientPicker : TemplatedControl
|
||||
public ColorGradient ColorGradient
|
||||
{
|
||||
get => GetValue(ColorGradientProperty);
|
||||
set => SetValue(ColorGradientProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(ColorGradientProperty, value);
|
||||
ApplyToField();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -176,7 +180,7 @@ public class GradientPicker : TemplatedControl
|
||||
if (_randomize != null)
|
||||
_randomize.Click -= RandomizeOnClick;
|
||||
|
||||
_colorPicker = e.NameScope.Find<ColorPicker>("ColorPicker");
|
||||
_colorPicker = e.NameScope.Find<FAColorPicker>("ColorPicker");
|
||||
_gradient = e.NameScope.Find<Border>("Gradient");
|
||||
_spreadStops = e.NameScope.Find<Button>("SpreadStops");
|
||||
_toggleSeamless = e.NameScope.Find<Button>("ToggleSeamless");
|
||||
@@ -220,16 +224,6 @@ public class GradientPicker : TemplatedControl
|
||||
_shiftDown = false;
|
||||
}
|
||||
|
||||
|
||||
private static void ColorGradientChanged(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
(sender as GradientPicker)?.ApplyToField();
|
||||
}
|
||||
|
||||
private static void StorageProviderChanged(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
}
|
||||
|
||||
private void ApplyToField()
|
||||
{
|
||||
EditingColorGradient = new ColorGradient(ColorGradient);
|
||||
|
||||
@@ -12,7 +12,6 @@ using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using FluentAvalonia.Core;
|
||||
using Button = FluentAvalonia.UI.Controls.Button;
|
||||
|
||||
namespace Artemis.UI.Shared.Controls.GradientPicker;
|
||||
|
||||
@@ -25,7 +24,7 @@ public class GradientPickerButton : TemplatedControl
|
||||
/// Gets or sets the color gradient.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<ColorGradient?> ColorGradientProperty =
|
||||
AvaloniaProperty.Register<GradientPickerButton, ColorGradient?>(nameof(ColorGradient), notifying: ColorGradientChanged);
|
||||
AvaloniaProperty.Register<GradientPickerButton, ColorGradient?>(nameof(ColorGradient));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean indicating whether the gradient picker should be in compact mode or not.
|
||||
@@ -54,7 +53,11 @@ public class GradientPickerButton : TemplatedControl
|
||||
public ColorGradient? ColorGradient
|
||||
{
|
||||
get => GetValue(ColorGradientProperty);
|
||||
set => SetValue(ColorGradientProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(ColorGradientProperty, value);
|
||||
Subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,12 +108,6 @@ public class GradientPickerButton : TemplatedControl
|
||||
|
||||
#endregion
|
||||
|
||||
private static void ColorGradientChanged(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
if (!before)
|
||||
(sender as GradientPickerButton)?.Subscribe();
|
||||
}
|
||||
|
||||
private void Subscribe()
|
||||
{
|
||||
Unsubscribe();
|
||||
|
||||
@@ -16,7 +16,7 @@ internal class GradientPickerColorStop : TemplatedControl
|
||||
/// Gets or sets the gradient picker.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<GradientPicker?> GradientPickerProperty =
|
||||
AvaloniaProperty.Register<GradientPickerColorStop, GradientPicker?>(nameof(GradientPicker), notifying: Notifying);
|
||||
AvaloniaProperty.Register<GradientPickerColorStop, GradientPicker?>(nameof(GradientPicker));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color stop.
|
||||
@@ -28,8 +28,8 @@ internal class GradientPickerColorStop : TemplatedControl
|
||||
/// Gets or sets the position reference to use when positioning and dragging this color stop.
|
||||
/// <para>If <see langword="null" /> then dragging is not enabled.</para>
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<IControl?> PositionReferenceProperty =
|
||||
AvaloniaProperty.Register<GradientPickerColorStop, IControl?>(nameof(PositionReference));
|
||||
public static readonly StyledProperty<Control?> PositionReferenceProperty =
|
||||
AvaloniaProperty.Register<GradientPickerColorStop, Control?>(nameof(PositionReference));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the linear gradient brush representing the color gradient.
|
||||
@@ -47,7 +47,16 @@ internal class GradientPickerColorStop : TemplatedControl
|
||||
public GradientPicker? GradientPicker
|
||||
{
|
||||
get => GetValue(GradientPickerProperty);
|
||||
set => SetValue(GradientPickerProperty, value);
|
||||
set
|
||||
{
|
||||
if (GradientPicker != null)
|
||||
GradientPicker.PropertyChanged -= GradientPickerOnPropertyChanged;
|
||||
SetValue(GradientPickerProperty, value);
|
||||
if (GradientPicker != null)
|
||||
GradientPicker.PropertyChanged += GradientPickerOnPropertyChanged;
|
||||
|
||||
IsSelected = ReferenceEquals(GradientPicker?.SelectedColorStop, ColorStop);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -63,7 +72,7 @@ internal class GradientPickerColorStop : TemplatedControl
|
||||
/// Gets or sets the position reference to use when positioning and dragging this color stop.
|
||||
/// <para>If <see langword="null" /> then dragging is not enabled.</para>
|
||||
/// </summary>
|
||||
public IControl? PositionReference
|
||||
public Control? PositionReference
|
||||
{
|
||||
get => GetValue(PositionReferenceProperty);
|
||||
set => SetValue(PositionReferenceProperty, value);
|
||||
@@ -85,19 +94,6 @@ internal class GradientPickerColorStop : TemplatedControl
|
||||
}
|
||||
}
|
||||
|
||||
private static void Notifying(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
if (sender is not GradientPickerColorStop self)
|
||||
return;
|
||||
|
||||
if (before && self.GradientPicker != null)
|
||||
self.GradientPicker.PropertyChanged -= self.GradientPickerOnPropertyChanged;
|
||||
else if (self.GradientPicker != null)
|
||||
self.GradientPicker.PropertyChanged += self.GradientPickerOnPropertyChanged;
|
||||
|
||||
self.IsSelected = ReferenceEquals(self.GradientPicker?.SelectedColorStop, self.ColorStop);
|
||||
}
|
||||
|
||||
private void GradientPickerOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
if (GradientPicker != null && e.Property == GradientPicker.SelectedColorStopProperty)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.UI.Shared;
|
||||
/// <summary>
|
||||
/// Represents a control that can be used to display or edit <see cref="Core.Hotkey" /> instances.
|
||||
/// </summary>
|
||||
public class HotkeyBox : UserControl
|
||||
public partial class HotkeyBox : UserControl
|
||||
{
|
||||
private readonly TextBox _displayTextBox;
|
||||
|
||||
@@ -34,11 +34,6 @@ public class HotkeyBox : UserControl
|
||||
UpdateDisplayTextBox();
|
||||
}
|
||||
|
||||
private static void HotkeyChanging(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
((HotkeyBox) sender).UpdateDisplayTextBox();
|
||||
}
|
||||
|
||||
private void DisplayTextBoxOnKeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key >= Key.LeftShift && e.Key <= Key.RightAlt)
|
||||
@@ -92,20 +87,17 @@ public class HotkeyBox : UserControl
|
||||
/// Gets or sets the currently displayed icon as either a <see cref="MaterialIconKind" /> or an <see cref="Uri" />
|
||||
/// pointing to an SVG
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<Hotkey?> HotkeyProperty =
|
||||
AvaloniaProperty.Register<HotkeyBox, Hotkey?>(nameof(Hotkey), defaultBindingMode: BindingMode.TwoWay, notifying: HotkeyChanging);
|
||||
public static readonly StyledProperty<Hotkey?> HotkeyProperty = AvaloniaProperty.Register<HotkeyBox, Hotkey?>(nameof(Hotkey), defaultBindingMode: BindingMode.TwoWay);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the watermark of the hotkey box when it is empty.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<string?> WatermarkProperty =
|
||||
AvaloniaProperty.Register<HotkeyBox, string?>(nameof(Watermark));
|
||||
public static readonly StyledProperty<string?> WatermarkProperty = AvaloniaProperty.Register<HotkeyBox, string?>(nameof(Watermark));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean indicating whether the watermark should float above the hotkey box when it is not empty.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<bool> UseFloatingWatermarkProperty =
|
||||
AvaloniaProperty.Register<HotkeyBox, bool>(nameof(UseFloatingWatermark));
|
||||
public static readonly StyledProperty<bool> UseFloatingWatermarkProperty = AvaloniaProperty.Register<HotkeyBox, bool>(nameof(UseFloatingWatermark));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently displayed icon as either a <see cref="MaterialIconKind" /> or an <see cref="Uri" />
|
||||
@@ -114,7 +106,11 @@ public class HotkeyBox : UserControl
|
||||
public Hotkey? Hotkey
|
||||
{
|
||||
get => GetValue(HotkeyProperty);
|
||||
set => SetValue(HotkeyProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(HotkeyProperty, value);
|
||||
UpdateDisplayTextBox();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,13 +3,13 @@ using System.IO;
|
||||
using Artemis.Core;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.Visuals.Media.Imaging;
|
||||
using Material.Icons;
|
||||
using Material.Icons.Avalonia;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Artemis.UI.Shared;
|
||||
/// <summary>
|
||||
/// Represents a control that can display the icon of a specific <see cref="ProfileConfiguration" />.
|
||||
/// </summary>
|
||||
public class ProfileConfigurationIcon : UserControl, IDisposable
|
||||
public partial class ProfileConfigurationIcon : UserControl, IDisposable
|
||||
{
|
||||
private Stream? _stream;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ProfileConfigurationIcon : UserControl, IDisposable
|
||||
|
||||
Content = new Border
|
||||
{
|
||||
Background = TextBlock.GetForeground(this),
|
||||
Background = TextElement.GetForeground(this),
|
||||
VerticalAlignment = VerticalAlignment.Stretch,
|
||||
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||
OpacityMask = new ImageBrush(new Bitmap(stream)) {BitmapInterpolationMode = BitmapInterpolationMode.MediumQuality}
|
||||
|
||||
@@ -40,8 +40,8 @@ public class SelectionRectangle : Control
|
||||
/// <summary>
|
||||
/// Defines the <see cref="InputElement" /> property.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<IControl?> InputElementProperty =
|
||||
AvaloniaProperty.Register<SelectionRectangle, IControl?>(nameof(InputElement), notifying: OnInputElementChanged);
|
||||
public static readonly StyledProperty<InputElement?> InputElementProperty =
|
||||
AvaloniaProperty.Register<SelectionRectangle, InputElement?>(nameof(InputElement));
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="ZoomRatio" /> property.
|
||||
@@ -61,7 +61,7 @@ public class SelectionRectangle : Control
|
||||
private Rect? _displayRect;
|
||||
private bool _isSelecting;
|
||||
private Point _lastPosition;
|
||||
private IControl? _oldInputElement;
|
||||
private InputElement? _oldInputElement;
|
||||
private Point _startPosition;
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -110,10 +110,14 @@ public class SelectionRectangle : Control
|
||||
/// <summary>
|
||||
/// Gets or sets the element that captures input for the selection rectangle.
|
||||
/// </summary>
|
||||
public IControl? InputElement
|
||||
public InputElement? InputElement
|
||||
{
|
||||
get => GetValue(InputElementProperty);
|
||||
set => SetValue(InputElementProperty, value);
|
||||
set
|
||||
{
|
||||
SetValue(InputElementProperty, value);
|
||||
SubscribeToInputElement();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -162,11 +166,6 @@ public class SelectionRectangle : Control
|
||||
SelectionFinished?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private static void OnInputElementChanged(IAvaloniaObject sender, bool before)
|
||||
{
|
||||
((SelectionRectangle) sender).SubscribeToInputElement();
|
||||
}
|
||||
|
||||
private void ParentOnPointerMoved(object? sender, PointerEventArgs e)
|
||||
{
|
||||
// Point moved seems to trigger when the element under the mouse changes?
|
||||
@@ -185,13 +184,13 @@ public class SelectionRectangle : Control
|
||||
{
|
||||
e.Pointer.Capture(this);
|
||||
|
||||
_startPosition = e.GetPosition(Parent);
|
||||
_absoluteStartPosition = e.GetPosition(VisualRoot);
|
||||
_startPosition = e.GetPosition(Parent as Visual);
|
||||
_absoluteStartPosition = e.GetPosition(VisualRoot as Visual);
|
||||
_displayRect = null;
|
||||
}
|
||||
|
||||
Point currentPosition = e.GetPosition(Parent);
|
||||
Point absoluteCurrentPosition = e.GetPosition(VisualRoot);
|
||||
Point currentPosition = e.GetPosition(Parent as Visual);
|
||||
Point absoluteCurrentPosition = e.GetPosition(VisualRoot as Visual);
|
||||
|
||||
_displayRect = new Rect(
|
||||
new Point(Math.Min(_startPosition.X, currentPosition.X), Math.Min(_startPosition.Y, currentPosition.Y)),
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ParentWidthPercentageConverter : IValueConverter
|
||||
/// <inheritdoc />
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (parameter is not IControl parent || value is not double percentage)
|
||||
if (parameter is not Control parent || value is not double percentage)
|
||||
return value;
|
||||
|
||||
return parent.Width / 100.0 * percentage;
|
||||
@@ -24,7 +24,7 @@ public class ParentWidthPercentageConverter : IValueConverter
|
||||
/// <inheritdoc />
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (parameter is not IControl parent || value is not double real)
|
||||
if (parameter is not Control parent || value is not double real)
|
||||
return value;
|
||||
|
||||
return real / parent.Width * 100.0;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display;
|
||||
/// <summary>
|
||||
/// Represents a default data model display view.
|
||||
/// </summary>
|
||||
public class DefaultDataModelDisplayView : UserControl
|
||||
public partial class DefaultDataModelDisplayView : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="DefaultDataModelDisplayView" /> class.
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display;
|
||||
/// <summary>
|
||||
/// Represents a data model display view used to display <see cref="SKColor" /> values.
|
||||
/// </summary>
|
||||
public class SKColorDataModelDisplayView : UserControl
|
||||
public partial class SKColorDataModelDisplayView : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="SKColorDataModelDisplayView" /> class.
|
||||
|
||||
@@ -6,7 +6,7 @@ using Avalonia.VisualTree;
|
||||
namespace Artemis.UI.Shared.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides extension methods for Avalonia's <see cref="IVisual" /> type
|
||||
/// Provides extension methods for Avalonia's <see cref="Visual" /> type
|
||||
/// </summary>
|
||||
public static class VisualExtensions
|
||||
{
|
||||
@@ -16,15 +16,15 @@ public static class VisualExtensions
|
||||
/// <typeparam name="T">The type the children should have.</typeparam>
|
||||
/// <param name="root">The root visual at which to start searching.</param>
|
||||
/// <returns>A recursive list of all visual children of type <typeparamref name="T" />.</returns>
|
||||
public static List<T> GetVisualChildrenOfType<T>(this IVisual root)
|
||||
public static List<T> GetVisualChildrenOfType<T>(this Visual root)
|
||||
{
|
||||
List<T> result = new();
|
||||
|
||||
List<IVisual>? visualChildren = root.GetVisualChildren()?.ToList();
|
||||
List<Visual>? visualChildren = root.GetVisualChildren()?.ToList();
|
||||
if (visualChildren == null || !visualChildren.Any())
|
||||
return result;
|
||||
|
||||
foreach (IVisual visualChild in visualChildren)
|
||||
foreach (Visual visualChild in visualChildren)
|
||||
{
|
||||
if (visualChild is T toFind)
|
||||
result.Add(toFind);
|
||||
@@ -41,15 +41,15 @@ public static class VisualExtensions
|
||||
/// <typeparam name="T">The type of data context the children should have.</typeparam>
|
||||
/// <param name="root">The root visual at which to start searching.</param>
|
||||
/// <returns>A recursive list of all visual children with a data context of type <typeparamref name="T" />.</returns>
|
||||
public static List<T> GetVisualChildrenOfDataContextType<T>(this IVisual root)
|
||||
public static List<T> GetVisualChildrenOfDataContextType<T>(this Visual root)
|
||||
{
|
||||
List<T> result = new();
|
||||
|
||||
List<IVisual>? visualChildren = root.GetVisualChildren()?.ToList();
|
||||
List<Visual>? visualChildren = root.GetVisualChildren()?.ToList();
|
||||
if (visualChildren == null || !visualChildren.Any())
|
||||
return result;
|
||||
|
||||
foreach (IVisual visualChild in visualChildren)
|
||||
foreach (Visual visualChild in visualChildren)
|
||||
{
|
||||
if (visualChild is IDataContextProvider dataContextProvider && dataContextProvider.DataContext is T toFind)
|
||||
result.Add(toFind);
|
||||
|
||||
+5
-5
@@ -4,8 +4,8 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Immutable;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using FluentAvalonia.UI.Media;
|
||||
using FluentAvalonia.UI.Windowing;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Shared;
|
||||
@@ -17,18 +17,18 @@ namespace Artemis.UI.Shared;
|
||||
/// and vice versa.
|
||||
/// </summary>
|
||||
/// <typeparam name="TViewModel">ViewModel type.</typeparam>
|
||||
public class ReactiveCoreWindow<TViewModel> : CoreWindow, IViewFor<TViewModel> where TViewModel : class
|
||||
public class ReactiveAppWindow<TViewModel> : AppWindow, IViewFor<TViewModel> where TViewModel : class
|
||||
{
|
||||
/// <summary>
|
||||
/// The ViewModel.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<TViewModel?> ViewModelProperty = AvaloniaProperty
|
||||
.Register<ReactiveCoreWindow<TViewModel>, TViewModel?>(nameof(ViewModel));
|
||||
.Register<ReactiveAppWindow<TViewModel>, TViewModel?>(nameof(ViewModel));
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReactiveCoreWindow{TViewModel}" /> class.
|
||||
/// Initializes a new instance of the <see cref="ReactiveAppWindow{TViewModel}" /> class.
|
||||
/// </summary>
|
||||
public ReactiveCoreWindow()
|
||||
public ReactiveAppWindow()
|
||||
{
|
||||
// This WhenActivated block calls ViewModel's WhenActivated
|
||||
// block if the ViewModel implements IActivatableViewModel.
|
||||
@@ -116,7 +116,7 @@ public class NotificationBuilder
|
||||
/// <exception cref="ArtemisSharedUIException" />
|
||||
public Action Show()
|
||||
{
|
||||
IPanel? panel = _parent.Find<IPanel>("NotificationContainer");
|
||||
Panel? panel = _parent.Find<Panel>("NotificationContainer");
|
||||
if (panel == null)
|
||||
throw new ArtemisSharedUIException("Can't display a notification on a window without a NotificationContainer.");
|
||||
|
||||
@@ -202,7 +202,7 @@ public class NotificationButtonBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
internal IControl Build()
|
||||
internal Control Build()
|
||||
{
|
||||
if (_action != null)
|
||||
return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action()), Classes = new Classes("AppBarButton")};
|
||||
|
||||
@@ -4,7 +4,7 @@ using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Shared.Services;
|
||||
|
||||
internal class ExceptionDialogView : ReactiveWindow<ExceptionDialogViewModel>
|
||||
internal partial class ExceptionDialogView : ReactiveWindow<ExceptionDialogViewModel>
|
||||
{
|
||||
public ExceptionDialogView()
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<Grid Height="24" ColumnDefinitions="*">
|
||||
<Grid Height="24" ColumnDefinitions="*">
|
||||
<TextBox Classes="condensed"
|
||||
Text="#FFFF0000"
|
||||
Padding="2 2 30 2">
|
||||
</TextBox>
|
||||
<controls:ColorPickerButton Classes="contained-color-picker-button"
|
||||
ShowAcceptDismissButtons="False"/>
|
||||
ShowAcceptDismissButtons="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
@@ -27,19 +27,19 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<controls:Button Name="MainButton"
|
||||
Padding="0"
|
||||
BorderThickness="0"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Button Name="MainButton"
|
||||
Padding="0"
|
||||
BorderThickness="0"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Border BorderBrush="{DynamicResource ColorPickerButtonOutline}"
|
||||
BorderThickness="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
MinWidth="18" MinHeight="18"
|
||||
Background="{TemplateBinding Color, Converter={StaticResource ColorBrushConv}}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<controls:ColorPicker Name="ColorPicker" IsVisible="False" />
|
||||
<controls:FAColorPicker Name="ColorPicker" IsVisible="False" />
|
||||
</Border>
|
||||
</controls:Button>
|
||||
</Button>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
@@ -48,4 +48,4 @@
|
||||
<Style Selector="controls|ColorPickerButton.contained-color-picker-button /template/ Viewbox">
|
||||
<Setter Property="IsVisible" Value="False"></Setter>
|
||||
</Style>
|
||||
</Styles>
|
||||
</Styles>
|
||||
@@ -102,7 +102,7 @@
|
||||
<Setter Property="MinHeight" Value="24" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="dataModelPicker|DataModelPickerButton.condensed /template/ controls|Button">
|
||||
<Style Selector="dataModelPicker|DataModelPickerButton.condensed /template/ Button">
|
||||
<Setter Property="Padding" Value="6 3 11 3" />
|
||||
<Setter Property="Height" Value="24" />
|
||||
</Style>
|
||||
|
||||
@@ -27,20 +27,20 @@
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<controls:Button Name="MainButton"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
Width="{TemplateBinding Width}"
|
||||
Height="{TemplateBinding Height}"
|
||||
HorizontalContentAlignment="Stretch">
|
||||
<Button Name="MainButton"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
Width="{TemplateBinding Width}"
|
||||
Height="{TemplateBinding Height}"
|
||||
HorizontalContentAlignment="Stretch">
|
||||
<Grid ColumnDefinitions="*,Auto" HorizontalAlignment="Stretch">
|
||||
<TextBlock Name="MainButtonLabel"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Left"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Name="ChevronTextBlock"
|
||||
Grid.Column="1"
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
@@ -51,7 +51,7 @@
|
||||
Padding="2 2 2 0"
|
||||
Margin="5 0" />
|
||||
</Grid>
|
||||
</controls:Button>
|
||||
</Button>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
@@ -168,14 +168,14 @@
|
||||
BorderBrush="{DynamicResource ButtonBorderBrush}"
|
||||
BorderThickness="0 0 1 0"
|
||||
Padding="0 0 10 0">
|
||||
<fluent:ColorPicker Name="ColorPicker"
|
||||
ColorTextType="HexAlpha"
|
||||
UseColorWheel="True"
|
||||
UseColorTriangle="True"
|
||||
IsMoreButtonVisible="True"
|
||||
IsVisible="{TemplateBinding SelectedColorStop, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
IsCompact="{Binding IsCompact, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Color="{Binding SelectedColorStop.Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource SKColorToColorConverter}}" />
|
||||
<fluent:FAColorPicker Name="ColorPicker"
|
||||
ColorTextType="HexAlpha"
|
||||
UseColorWheel="True"
|
||||
UseColorTriangle="True"
|
||||
IsMoreButtonVisible="True"
|
||||
IsVisible="{TemplateBinding SelectedColorStop, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
IsCompact="{Binding IsCompact, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Color="{Binding SelectedColorStop.Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource SKColorToColorConverter}}" />
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="1" RowDefinitions="*,Auto">
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<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:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20" Width="200">
|
||||
<StackPanel Spacing="5">
|
||||
<gradientPicker:GradientPickerButton IsCompact="True" />
|
||||
<ComboBox HorizontalAlignment="Stretch"></ComboBox>
|
||||
<controls:DropDownButton HorizontalAlignment="Stretch"></controls:DropDownButton>
|
||||
<DropDownButton HorizontalAlignment="Stretch"></DropDownButton>
|
||||
</StackPanel>
|
||||
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
@@ -31,14 +29,14 @@
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
|
||||
<controls:Button
|
||||
<Button
|
||||
Name="MainButton"
|
||||
Padding="0 0 12 0"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch">
|
||||
Padding="0 0 12 0"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<Border Classes="gradient-display"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -54,7 +52,7 @@
|
||||
Margin="4,0,0,0" />
|
||||
|
||||
</Grid>
|
||||
</controls:Button>
|
||||
</Button>
|
||||
|
||||
|
||||
</ControlTemplate>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="30" MinWidth="350" Height="600">
|
||||
<TreeView Classes="no-right-margin">
|
||||
<TreeViewItem>
|
||||
<TreeViewItem.Header>
|
||||
<Border BorderThickness="2" BorderBrush="Red">
|
||||
<TextBlock>Test</TextBlock>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
</TreeViewItem.Header>
|
||||
</TreeViewItem.Header>
|
||||
</TreeViewItem>
|
||||
<TreeViewItem Header="Item 2" IsExpanded="True">
|
||||
<TreeViewItem>
|
||||
@@ -21,7 +21,7 @@
|
||||
</TreeViewItem>
|
||||
<TreeViewItem Header="SubItem2" />
|
||||
<TreeViewItem Header="SubItem3" IsExpanded="True">
|
||||
<TreeViewItem>
|
||||
<TreeViewItem>
|
||||
<TreeViewItem.Header>
|
||||
<Border BorderThickness="2" BorderBrush="Red">
|
||||
<TextBlock>Test</TextBlock>
|
||||
@@ -32,17 +32,17 @@
|
||||
<TreeViewItem Header="SubItem Item3" />
|
||||
</TreeViewItem>
|
||||
</TreeViewItem>
|
||||
<TreeViewItem Header="Item3" IsEnabled="False"/>
|
||||
<TreeViewItem Header="Item3" IsEnabled="False" />
|
||||
<TreeViewItem Header="Item4" />
|
||||
</TreeView>
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<Style Selector="TreeView.no-right-margin TreeViewItem">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<StackPanel>
|
||||
<Border Name="PART_LayoutRoot"
|
||||
<Style Selector="TreeView.no-right-margin TreeViewItem">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<StackPanel>
|
||||
<Border Name="PART_LayoutRoot"
|
||||
Classes="TreeViewItemLayoutRoot"
|
||||
Focusable="True"
|
||||
Background="{TemplateBinding Background}"
|
||||
@@ -52,56 +52,59 @@
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
TemplatedControl.IsTemplateFocusTarget="True"
|
||||
Margin="2 2 0 2">
|
||||
<Panel>
|
||||
<Border Name="SelectionIndicator"
|
||||
Width="3"
|
||||
Height="16"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2" />
|
||||
|
||||
<Grid Name="PART_Header"
|
||||
ColumnDefinitions="Auto, *"
|
||||
Margin="{TemplateBinding Level, Mode=OneWay, Converter={StaticResource TreeViewItemLeftMarginConverter}}">
|
||||
<Panel Name="PART_ExpandCollapseChevronContainer"
|
||||
Margin="8 0 4 0">
|
||||
<ToggleButton Name="PART_ExpandCollapseChevron"
|
||||
Classes="ExpandCollapseChevron"
|
||||
<Panel>
|
||||
<Rectangle Name="SelectionIndicator"
|
||||
Width="3"
|
||||
Height="16"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
RadiusX="2"
|
||||
RadiusY="2"
|
||||
IsVisible="False"
|
||||
Fill="{DynamicResource TreeViewItemSelectionIndicatorForeground}" />
|
||||
|
||||
<Grid Name="PART_Header"
|
||||
ColumnDefinitions="Auto, *"
|
||||
Margin="{TemplateBinding Level, Mode=OneWay, Converter={StaticResource TreeViewItemLeftMarginConverter}}">
|
||||
<Panel Name="PART_ExpandCollapseChevronContainer"
|
||||
Margin="{StaticResource TreeViewItemExpandCollapseChevronMargin}">
|
||||
<ToggleButton Name="PART_ExpandCollapseChevron"
|
||||
Theme="{StaticResource TreeViewChevronButton}"
|
||||
Focusable="False"
|
||||
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
|
||||
</Panel>
|
||||
<ContentPresenter Name="PART_HeaderPresenter"
|
||||
</Panel>
|
||||
<ContentPresenter Name="PART_HeaderPresenter"
|
||||
Grid.Column="1"
|
||||
Focusable="False"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
Margin="{TemplateBinding Padding}" />
|
||||
</Grid>
|
||||
</Panel>
|
||||
</Border>
|
||||
<ItemsPresenter Name="PART_ItemsPresenter"
|
||||
</Grid>
|
||||
</Panel>
|
||||
</Border>
|
||||
<ItemsPresenter Name="PART_ItemsPresenter"
|
||||
IsVisible="{TemplateBinding IsExpanded}"
|
||||
Items="{TemplateBinding Items}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
Margin="2 2 0 2"/>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Border#TreeViewItemLayoutRoot Panel.PART_ExpandCollapseChevronContainer">
|
||||
<Style Selector="Border#TreeViewItemLayoutRoot Panel.PART_ExpandCollapseChevronContainer">
|
||||
<Setter Property="Margin" Value="0"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TreeView TreeViewItem[IsEnabled=False]">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDisabledForegroundThemeBrush}"/>
|
||||
<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> -->
|
||||
<!-- <Style Selector="TreeView.no-right-margin TreeViewItem /template/ StackPanel ItemsPresenter#PART_ItemsPresenter"> -->
|
||||
<!-- <Setter Property="Margin" Value="2 2 0 2"/> -->
|
||||
<!-- </Style> -->
|
||||
</Styles>
|
||||
<!-- <Style Selector="TreeView.no-right-margin TreeViewItem /template/ Border#TreeViewItemLayoutRoot"> -->
|
||||
<!-- <Setter Property="Margin" Value="2 2 0 2"/> -->
|
||||
<!-- </Style> -->
|
||||
<!-- <Style Selector="TreeView.no-right-margin TreeViewItem /template/ StackPanel ItemsPresenter#PART_ItemsPresenter"> -->
|
||||
<!-- <Setter Property="Margin" Value="2 2 0 2"/> -->
|
||||
<!-- </Style> -->
|
||||
</Styles>
|
||||
Reference in new issue
Block a user