1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-02-04 10:53:31 +00:00

Fixed custom controls not responding to changes, fixed title bar interaciton

This commit is contained in:
Robert 2023-04-02 10:40:54 +02:00
parent 02e85af4af
commit 82b41425aa
20 changed files with 141 additions and 120 deletions

View File

@ -58,7 +58,7 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v2 uses: actions/setup-dotnet@v2
with: with:
dotnet-version: '6.0.x' dotnet-version: '7.0.x'
- name: Publish Artemis - name: Publish Artemis
run: dotnet publish --configuration Release -p:Version=${{ needs.version.outputs.version-number }} --runtime ${{ matrix.rid }} --output build/${{ matrix.rid }} --self-contained Artemis/src/Artemis.UI.${{ matrix.csproj }}/Artemis.UI.${{ matrix.csproj }}.csproj run: dotnet publish --configuration Release -p:Version=${{ needs.version.outputs.version-number }} --runtime ${{ matrix.rid }} --output build/${{ matrix.rid }} --self-contained Artemis/src/Artemis.UI.${{ matrix.csproj }}/Artemis.UI.${{ matrix.csproj }}.csproj
- name: Publish Plugins - name: Publish Plugins

View File

@ -28,6 +28,7 @@ public partial class ArtemisIcon : UserControl
InitializeComponent(); InitializeComponent();
DetachedFromLogicalTree += OnDetachedFromLogicalTree; DetachedFromLogicalTree += OnDetachedFromLogicalTree;
LayoutUpdated += OnLayoutUpdated; LayoutUpdated += OnLayoutUpdated;
PropertyChanged += OnPropertyChanged;
} }
private void Update() private void Update()
@ -87,6 +88,12 @@ public partial class ArtemisIcon : UserControl
} }
} }
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == IconProperty || e.Property == FillProperty)
Update();
}
private void OnDetachedFromLogicalTree(object? sender, LogicalTreeAttachmentEventArgs e) private void OnDetachedFromLogicalTree(object? sender, LogicalTreeAttachmentEventArgs e)
{ {
if (Content is Image image && image.Source is IDisposable disposable) if (Content is Image image && image.Source is IDisposable disposable)
@ -109,11 +116,7 @@ public partial class ArtemisIcon : UserControl
public object? Icon public object? Icon
{ {
get => GetValue(IconProperty); get => GetValue(IconProperty);
set set => SetValue(IconProperty, value);
{
SetValue(IconProperty, value);
Update();
}
} }
/// <summary> /// <summary>
@ -129,11 +132,7 @@ public partial class ArtemisIcon : UserControl
public bool Fill public bool Fill
{ {
get => GetValue(FillProperty); get => GetValue(FillProperty);
set set => SetValue(FillProperty, value);
{
SetValue(FillProperty, value);
Update();
}
} }
#endregion #endregion

View File

@ -38,12 +38,14 @@ public class DeviceVisualizer : Control
_deviceVisualizerLeds = new List<DeviceVisualizerLed>(); _deviceVisualizerLeds = new List<DeviceVisualizerLed>();
PointerReleased += OnPointerReleased; PointerReleased += OnPointerReleased;
PropertyChanged += OnPropertyChanged;
} }
/// <inheritdoc /> /// <inheritdoc />
public override void Render(DrawingContext drawingContext) public override void Render(DrawingContext drawingContext)
{ {
if (Device == null) if (Device == null || _deviceBounds.Width == 0 || _deviceBounds.Height == 0)
return; return;
// Determine the scale required to fit the desired size of the control // Determine the scale required to fit the desired size of the control
@ -54,11 +56,11 @@ public class DeviceVisualizer : Control
{ {
// Scale the visualization in the desired bounding box // Scale the visualization in the desired bounding box
if (Bounds.Width > 0 && Bounds.Height > 0) if (Bounds.Width > 0 && Bounds.Height > 0)
boundsPush = drawingContext.PushPreTransform(Matrix.CreateScale(scale, scale)); boundsPush = drawingContext.PushTransform(Matrix.CreateScale(scale, scale));
// Apply device rotation // Apply device rotation
using DrawingContext.PushedState translationPush = drawingContext.PushPreTransform(Matrix.CreateTranslation(0 - _deviceBounds.Left, 0 - _deviceBounds.Top)); using DrawingContext.PushedState translationPush = drawingContext.PushTransform(Matrix.CreateTranslation(0 - _deviceBounds.Left, 0 - _deviceBounds.Top));
using DrawingContext.PushedState rotationPush = drawingContext.PushPreTransform(Matrix.CreateRotation(Matrix.ToRadians(Device.Rotation))); using DrawingContext.PushedState rotationPush = drawingContext.PushTransform(Matrix.CreateRotation(Matrix.ToRadians(Device.Rotation)));
// Render device and LED images // Render device and LED images
if (_deviceImage != null) if (_deviceImage != null)
@ -75,7 +77,7 @@ public class DeviceVisualizer : Control
lock (_deviceVisualizerLeds) lock (_deviceVisualizerLeds)
{ {
// Apply device scale // Apply device scale
using DrawingContext.PushedState scalePush = drawingContext.PushPreTransform(Matrix.CreateScale(Device.Scale, Device.Scale)); using DrawingContext.PushedState scalePush = drawingContext.PushTransform(Matrix.CreateScale(Device.Scale, Device.Scale));
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds) foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)
deviceVisualizerLed.RenderGeometry(drawingContext, false); deviceVisualizerLed.RenderGeometry(drawingContext, false);
} }
@ -152,6 +154,12 @@ public class DeviceVisualizer : Control
OnClicked(e); OnClicked(e);
} }
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == DeviceProperty)
SetupForDevice();
}
private void DevicePropertyChanged(object? sender, PropertyChangedEventArgs e) private void DevicePropertyChanged(object? sender, PropertyChangedEventArgs e)
{ {
Dispatcher.UIThread.Post(SetupForDevice, DispatcherPriority.Background); Dispatcher.UIThread.Post(SetupForDevice, DispatcherPriority.Background);
@ -176,11 +184,7 @@ public class DeviceVisualizer : Control
public ArtemisDevice? Device public ArtemisDevice? Device
{ {
get => GetValue(DeviceProperty); get => GetValue(DeviceProperty);
set set => SetValue(DeviceProperty, value);
{
SetValue(DeviceProperty, value);
SetupForDevice();
}
} }
/// <summary> /// <summary>

View File

@ -23,7 +23,7 @@
</UserControl.Styles> </UserControl.Styles>
<Panel> <Panel>
<controls:NumberBox Name="NumberBox" <controls:NumberBox Name="InnerNumberBox"
AcceptsExpression="True" AcceptsExpression="True"
LargeChange="{Binding $parent[sharedControls:DraggableNumberBox].LargeChange}" LargeChange="{Binding $parent[sharedControls:DraggableNumberBox].LargeChange}"
SmallChange="{Binding $parent[sharedControls:DraggableNumberBox].SmallChange}" SmallChange="{Binding $parent[sharedControls:DraggableNumberBox].SmallChange}"

View File

@ -68,11 +68,12 @@ public partial class DraggableNumberBox : UserControl
public DraggableNumberBox() public DraggableNumberBox()
{ {
InitializeComponent(); InitializeComponent();
NumberBox.Value = Value; InnerNumberBox.Value = Value;
PointerPressed += OnPointerPressed; PointerPressed += OnPointerPressed;
PointerMoved += OnPointerMoved; PointerMoved += OnPointerMoved;
PointerReleased += OnPointerReleased; PointerReleased += OnPointerReleased;
PropertyChanged += OnPropertyChanged;
AddHandler(KeyUpEvent, HandleKeyUp, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); AddHandler(KeyUpEvent, HandleKeyUp, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
} }
@ -83,11 +84,7 @@ public partial class DraggableNumberBox : UserControl
public double Value public double Value
{ {
get => GetValue(ValueProperty); get => GetValue(ValueProperty);
set set => SetValue(ValueProperty, value);
{
SetValue(ValueProperty, value);
SetNumberBoxValue(value);
}
} }
/// <summary> /// <summary>
@ -165,11 +162,11 @@ public partial class DraggableNumberBox : UserControl
private void SetNumberBoxValue(double value) private void SetNumberBoxValue(double value)
{ {
if (!(Math.Abs(NumberBox.Value - Value) > 0.00001)) if (!(Math.Abs(InnerNumberBox.Value - Value) > 0.00001))
return; return;
_updating = true; _updating = true;
NumberBox.Value = Value; InnerNumberBox.Value = Value;
_updating = false; _updating = false;
} }
@ -182,7 +179,7 @@ public partial class DraggableNumberBox : UserControl
private void OnPointerPressed(object? sender, PointerPressedEventArgs e) private void OnPointerPressed(object? sender, PointerPressedEventArgs e)
{ {
PointerPoint point = e.GetCurrentPoint(this); PointerPoint point = e.GetCurrentPoint(this);
_inputTextBox = NumberBox.FindDescendantOfType<TextBox>(); _inputTextBox = InnerNumberBox.FindDescendantOfType<TextBox>();
_moved = false; _moved = false;
_startX = point.Position.X; _startX = point.Position.X;
_lastX = point.Position.X; _lastX = point.Position.X;
@ -247,6 +244,12 @@ public partial class DraggableNumberBox : UserControl
e.Handled = true; e.Handled = true;
} }
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == ValueProperty)
SetNumberBoxValue(Value);
}
private void NumberBox_OnValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args) private void NumberBox_OnValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args)
{ {
if (_updating) if (_updating)
@ -254,17 +257,17 @@ public partial class DraggableNumberBox : UserControl
if (args.NewValue < Minimum) if (args.NewValue < Minimum)
{ {
NumberBox.Value = Minimum; InnerNumberBox.Value = Minimum;
return; return;
} }
if (args.NewValue > Maximum) if (args.NewValue > Maximum)
{ {
NumberBox.Value = Maximum; InnerNumberBox.Value = Maximum;
return; return;
} }
if (Math.Abs(Value - NumberBox.Value) > 0.00001) if (Math.Abs(Value - InnerNumberBox.Value) > 0.00001)
Value = NumberBox.Value; Value = InnerNumberBox.Value;
} }
} }

View File

@ -30,21 +30,26 @@ public partial class EnumComboBox : UserControl
/// </summary> /// </summary>
public EnumComboBox() public EnumComboBox()
{ {
PropertyChanged += OnPropertyChanged;
InitializeComponent(); InitializeComponent();
} }
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == ValueProperty)
{
UpdateValues();
UpdateSelection();
}
}
/// <summary> /// <summary>
/// Gets or sets the currently selected value /// Gets or sets the currently selected value
/// </summary> /// </summary>
public object? Value public object? Value
{ {
get => GetValue(ValueProperty); get => GetValue(ValueProperty);
set set => SetValue(ValueProperty, value);
{
SetValue(ValueProperty, value);
UpdateValues();
UpdateSelection();
}
} }
private void OnSelectionChanged(object? sender, SelectionChangedEventArgs e) private void OnSelectionChanged(object? sender, SelectionChangedEventArgs e)

View File

@ -94,6 +94,8 @@ public class GradientPicker : TemplatedControl
SelectedColorStop = EditingColorGradient.ElementAtOrDefault(index); SelectedColorStop = EditingColorGradient.ElementAtOrDefault(index);
}); });
PropertyChanged += OnPropertyChanged;
} }
/// <summary> /// <summary>
@ -102,11 +104,7 @@ public class GradientPicker : TemplatedControl
public ColorGradient ColorGradient public ColorGradient ColorGradient
{ {
get => GetValue(ColorGradientProperty); get => GetValue(ColorGradientProperty);
set set => SetValue(ColorGradientProperty, value);
{
SetValue(ColorGradientProperty, value);
ApplyToField();
}
} }
/// <summary> /// <summary>
@ -342,4 +340,10 @@ public class GradientPicker : TemplatedControl
EditingColorGradient.Randomize(6); EditingColorGradient.Randomize(6);
SelectedColorStop = EditingColorGradient.First(); SelectedColorStop = EditingColorGradient.First();
} }
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == ColorGradientProperty)
ApplyToField();
}
} }

View File

@ -47,17 +47,19 @@ public class GradientPickerButton : TemplatedControl
private Button? _button; private Button? _button;
private ColorGradient? _lastColorGradient; private ColorGradient? _lastColorGradient;
/// <inheritdoc />
public GradientPickerButton()
{
PropertyChanged += OnPropertyChanged;
}
/// <summary> /// <summary>
/// Gets or sets the color gradient. /// Gets or sets the color gradient.
/// </summary> /// </summary>
public ColorGradient? ColorGradient public ColorGradient? ColorGradient
{ {
get => GetValue(ColorGradientProperty); get => GetValue(ColorGradientProperty);
set set => SetValue(ColorGradientProperty, value);
{
SetValue(ColorGradientProperty, value);
Subscribe();
}
} }
/// <summary> /// <summary>
@ -175,6 +177,12 @@ public class GradientPickerButton : TemplatedControl
LinearGradientBrush.GradientStops = collection; LinearGradientBrush.GradientStops = collection;
} }
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == ColorGradientProperty)
Subscribe();
}
#region Overrides of Visual #region Overrides of Visual
/// <inheritdoc /> /// <inheritdoc />

View File

@ -19,21 +19,24 @@ namespace Artemis.UI.Shared;
/// </summary> /// </summary>
public partial class HotkeyBox : UserControl public partial class HotkeyBox : UserControl
{ {
private readonly TextBox _displayTextBox;
/// <summary> /// <summary>
/// Creates a new instance of the <see cref="HotkeyBox" /> class /// Creates a new instance of the <see cref="HotkeyBox" /> class
/// </summary> /// </summary>
public HotkeyBox() public HotkeyBox()
{ {
InitializeComponent(); InitializeComponent();
PropertyChanged += OnPropertyChanged;
_displayTextBox = this.Find<TextBox>("DisplayTextBox"); DisplayTextBox.KeyDown += DisplayTextBoxOnKeyDown;
_displayTextBox.KeyDown += DisplayTextBoxOnKeyDown; DisplayTextBox.KeyUp += DisplayTextBoxOnKeyUp;
_displayTextBox.KeyUp += DisplayTextBoxOnKeyUp;
UpdateDisplayTextBox(); UpdateDisplayTextBox();
} }
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == HotkeyProperty)
UpdateDisplayTextBox();
}
private void DisplayTextBoxOnKeyDown(object? sender, KeyEventArgs e) private void DisplayTextBoxOnKeyDown(object? sender, KeyEventArgs e)
{ {
if (e.Key >= Key.LeftShift && e.Key <= Key.RightAlt) if (e.Key >= Key.LeftShift && e.Key <= Key.RightAlt)
@ -64,8 +67,8 @@ public partial class HotkeyBox : UserControl
if (Hotkey?.Key != null) if (Hotkey?.Key != null)
display = string.IsNullOrEmpty(display) ? Hotkey.Key.ToString() : $"{display}+{Hotkey.Key}"; display = string.IsNullOrEmpty(display) ? Hotkey.Key.ToString() : $"{display}+{Hotkey.Key}";
_displayTextBox.Text = display; DisplayTextBox.Text = display;
_displayTextBox.CaretIndex = _displayTextBox.Text?.Length ?? 0; DisplayTextBox.CaretIndex = DisplayTextBox.Text?.Length ?? 0;
} }
private void Button_OnClick(object? sender, RoutedEventArgs e) private void Button_OnClick(object? sender, RoutedEventArgs e)
@ -101,11 +104,7 @@ public partial class HotkeyBox : UserControl
public Hotkey? Hotkey public Hotkey? Hotkey
{ {
get => GetValue(HotkeyProperty); get => GetValue(HotkeyProperty);
set set => SetValue(HotkeyProperty, value);
{
SetValue(HotkeyProperty, value);
UpdateDisplayTextBox();
}
} }
/// <summary> /// <summary>

View File

@ -69,6 +69,14 @@ public class SelectionRectangle : Control
{ {
AffectsRender<TextBlock>(BackgroundProperty, BorderBrushProperty, BorderThicknessProperty); AffectsRender<TextBlock>(BackgroundProperty, BorderBrushProperty, BorderThicknessProperty);
IsHitTestVisible = false; IsHitTestVisible = false;
PropertyChanged += OnPropertyChanged;
}
private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == InputElementProperty)
SubscribeToInputElement();
} }
/// <summary> /// <summary>
@ -113,11 +121,7 @@ public class SelectionRectangle : Control
public InputElement? InputElement public InputElement? InputElement
{ {
get => GetValue(InputElementProperty); get => GetValue(InputElementProperty);
set set => SetValue(InputElementProperty, value);
{
SetValue(InputElementProperty, value);
SubscribeToInputElement();
}
} }
/// <summary> /// <summary>

View File

@ -28,13 +28,6 @@
<Setter Property="ClipToBounds" Value="True" /> <Setter Property="ClipToBounds" Value="True" />
</Style> </Style>
<Style Selector="Border#TitleBar">
<Setter Property="Height" Value="40"></Setter>
</Style>
<Style Selector="Window:windows Border#TitleBar">
<Setter Property="Margin" Value="0 0 138 0"></Setter>
</Style>
<Style Selector="Border.card"> <Style Selector="Border.card">
<Setter Property="Padding" Value="16" /> <Setter Property="Padding" Value="16" />
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" /> <Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />

View File

@ -5,6 +5,7 @@
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput"
xmlns:shared="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared" xmlns:shared="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared"
xmlns:behaviors="clr-namespace:Artemis.UI.Shared.Behaviors;assembly=Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="200" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="200" d:DesignHeight="450"
x:Class="Artemis.UI.DefaultTypes.PropertyInput.SKColorPropertyInputView" x:Class="Artemis.UI.DefaultTypes.PropertyInput.SKColorPropertyInputView"
x:DataType="propertyInput:SKColorPropertyInputViewModel"> x:DataType="propertyInput:SKColorPropertyInputViewModel">
@ -13,9 +14,10 @@
<shared:SKColorToColorConverter x:Key="SKColorToColorConverter" /> <shared:SKColorToColorConverter x:Key="SKColorToColorConverter" />
</UserControl.Resources> </UserControl.Resources>
<Grid Height="24" ColumnDefinitions="*"> <Grid Height="24" ColumnDefinitions="*">
<TextBox Classes="condensed" <TextBox Classes="condensed" Padding="2 2 30 2" FontFamily="Consolas">
Text="{CompiledBinding InputValue, Converter={StaticResource SKColorToStringConverter}}" <Interaction.Behaviors>
Padding="2 2 30 2"> <behaviors:LostFocusTextBoxBindingBehavior Text="{CompiledBinding InputValue, Converter={StaticResource SKColorToStringConverter}}" />
</Interaction.Behaviors>
</TextBox> </TextBox>
<controls:ColorPickerButton Classes="contained-color-picker-button" <controls:ColorPickerButton Classes="contained-color-picker-button"
Color="{CompiledBinding InputValue, Converter={StaticResource SKColorToColorConverter}}" Color="{CompiledBinding InputValue, Converter={StaticResource SKColorToColorConverter}}"

View File

@ -10,8 +10,17 @@
Title="Artemis 2.0" Title="Artemis 2.0"
MinWidth="600" MinWidth="600"
MinHeight="400"> MinHeight="400">
<windowing:AppWindow.Styles>
<Styles>
<Style Selector="Border#TitleBarContainer">
<Setter Property="Height" Value="40"></Setter>
</Style>
<Style Selector="windowing|AppWindow:windows Border#TitleBarContainer">
<Setter Property="Margin" Value="0 0 138 0"></Setter>
</Style>
</Styles>
</windowing:AppWindow.Styles>
<Panel Name="RootPanel"> <Panel Name="RootPanel">
<Border Name="DragHandle" Background="Transparent" Height="40" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
<DockPanel> <DockPanel>
<ContentControl Name="SidebarContentControl" Content="{Binding SidebarViewModel}" DockPanel.Dock="Left" Width="240"> <ContentControl Name="SidebarContentControl" Content="{Binding SidebarViewModel}" DockPanel.Dock="Left" Width="240">
<ContentControl.Transitions> <ContentControl.Transitions>
@ -20,8 +29,8 @@
</Transitions> </Transitions>
</ContentControl.Transitions> </ContentControl.Transitions>
</ContentControl> </ContentControl>
<Border Name="TitleBar" DockPanel.Dock="Top"> <Border Name="TitleBarContainer" DockPanel.Dock="Top">
<ContentControl Content="{Binding TitleBarViewModel}" /> <ContentControl Content="{Binding TitleBarViewModel}"/>
</Border> </Border>
<ContentControl Content="{Binding}" /> <ContentControl Content="{Binding}" />
</DockPanel> </DockPanel>

View File

@ -14,8 +14,6 @@ namespace Artemis.UI;
public partial class MainWindow : ReactiveAppWindow<RootViewModel> public partial class MainWindow : ReactiveAppWindow<RootViewModel>
{ {
private readonly Panel _rootPanel;
private readonly ContentControl _sidebarContentControl;
private bool _activated; private bool _activated;
public MainWindow() public MainWindow()
@ -24,12 +22,10 @@ public partial class MainWindow : ReactiveAppWindow<RootViewModel>
Activated += OnActivated; Activated += OnActivated;
Deactivated += OnDeactivated; Deactivated += OnDeactivated;
// ApplyWindowSize();
InitializeComponent(); InitializeComponent();
ApplyWindowSize();
_rootPanel = this.Get<Panel>("RootPanel"); RootPanel.LayoutUpdated += OnLayoutUpdated;
_sidebarContentControl = this.Get<ContentControl>("SidebarContentControl");
_rootPanel.LayoutUpdated += OnLayoutUpdated;
#if DEBUG #if DEBUG
this.AttachDevTools(); this.AttachDevTools();
@ -57,21 +53,15 @@ public partial class MainWindow : ReactiveAppWindow<RootViewModel>
RootViewModel.WindowSizeSetting.Value.ApplyFromWindow(this); RootViewModel.WindowSizeSetting.Value.ApplyFromWindow(this);
} }
// TODO: Replace with a media query once https://github.com/AvaloniaUI/Avalonia/pull/7938 is implemented
private void OnLayoutUpdated(object? sender, EventArgs e) private void OnLayoutUpdated(object? sender, EventArgs e)
{ {
_sidebarContentControl.Width = _rootPanel.Bounds.Width >= 1800 ? 300 : 240; SidebarContentControl.Width = RootPanel.Bounds.Width >= 1800 ? 300 : 240;
} }
private void OnOpened(object? sender, EventArgs e) private void OnOpened(object? sender, EventArgs e)
{ {
Opened -= OnOpened; Opened -= OnOpened;
// ICoreApplicationView coreAppTitleBar = this; TitleBar.ExtendsContentIntoTitleBar = true;
// if (coreAppTitleBar.TitleBar != null)
// {
// coreAppTitleBar.TitleBar.ExtendViewIntoTitleBar = true;
// SetTitleBar(this.Get<Border>("DragHandle"));
// }
} }
private void OnActivated(object? sender, EventArgs e) private void OnActivated(object? sender, EventArgs e)

View File

@ -84,11 +84,7 @@
</paz:ZoomBorder> </paz:ZoomBorder>
<Border CornerRadius="0 0 8 0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="{DynamicResource ControlFillColorDefaultBrush}"> <Border CornerRadius="0 0 8 0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="{DynamicResource ControlFillColorDefaultBrush}">
<StackPanel Orientation="Horizontal" Margin="8"> <StackPanel Orientation="Horizontal" Margin="8">
<shared:ProfileConfigurationIcon ConfigurationIcon="{CompiledBinding ProfileConfiguration.Icon}" <shared:ProfileConfigurationIcon ConfigurationIcon="{CompiledBinding ProfileConfiguration.Icon}" Width="18" Height="18" Margin="0 0 5 0" />
Foreground="{DynamicResource ToolTipForeground}"
Width="18"
Height="18"
Margin="0 0 5 0" />
<TextBlock Text="{CompiledBinding ProfileConfiguration.Name}" /> <TextBlock Text="{CompiledBinding ProfileConfiguration.Name}" />
</StackPanel> </StackPanel>
</Border> </Border>

View File

@ -3,15 +3,18 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
xmlns:profileEditor="clr-namespace:Artemis.UI.Screens.ProfileEditor"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.ProfileEditor.ProfileEditorTitleBarView"> x:Class="Artemis.UI.Screens.ProfileEditor.ProfileEditorTitleBarView"
<Grid ColumnDefinitions="Auto,*,Auto"> x:DataType="profileEditor:ProfileEditorTitleBarViewModel">
<ContentControl Grid.Row="0" Grid.Column="0" Content="{Binding MenuBarViewModel}" /> <Grid ColumnDefinitions="*,Auto">
<ContentControl Grid.Row="0" Grid.Column="0" Content="{CompiledBinding MenuBarViewModel}" windowing:AppWindow.AllowInteractionInTitleBar="True" HorizontalAlignment="Left" />
<!-- This border enables dragging the window in between the menu and the buttons--> <Button Grid.Column="1" Classes="title-bar-button"
<Border Grid.Row="0" Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="Transparent" IsHitTestVisible="False" /> Command="{CompiledBinding ShowDebugger}"
HorizontalAlignment="Right"
<Button Grid.Column="2" Classes="title-bar-button" Command="{Binding ShowDebugger}" HorizontalAlignment="Right" VerticalAlignment="Top"> VerticalAlignment="Top"
windowing:AppWindow.AllowInteractionInTitleBar="True">
<avalonia:MaterialIcon Kind="Bug" /> <avalonia:MaterialIcon Kind="Bug" />
</Button> </Button>
</Grid> </Grid>

View File

@ -3,9 +3,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Root.DefaultTitleBarView"> x:Class="Artemis.UI.Screens.Root.DefaultTitleBarView">
<Button Classes="title-bar-button" Command="{Binding ShowDebugger}" VerticalAlignment="Top" HorizontalAlignment="Right"> <Button Classes="title-bar-button" Command="{Binding ShowDebugger}" VerticalAlignment="Top" HorizontalAlignment="Right" windowing:AppWindow.AllowInteractionInTitleBar="True" >
<avalonia:MaterialIcon Kind="Bug"></avalonia:MaterialIcon> <avalonia:MaterialIcon Kind="Bug"></avalonia:MaterialIcon>
</Button> </Button>
</UserControl> </UserControl>

View File

@ -25,7 +25,7 @@
Margin="10 2" Margin="10 2"
Items="{CompiledBinding SidebarScreens}" Items="{CompiledBinding SidebarScreens}"
SelectedItem="{CompiledBinding SelectedSidebarScreen}" /> SelectedItem="{CompiledBinding SelectedSidebarScreen}" />
<Separator Grid.Row="2" Margin="8" Height="1" Background="#FF6c6c6c" /> <Border Grid.Row="2" Margin="8" Height="1" Background="{DynamicResource ButtonBorderBrush}"></Border>
<!-- Categories --> <!-- Categories -->
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto"> <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
@ -39,7 +39,7 @@
</ScrollViewer> </ScrollViewer>
<!-- Bottom buttons --> <!-- Bottom buttons -->
<Separator Grid.Row="4" Margin="8" /> <Border Grid.Row="4" Margin="8" Height="1" Background="{DynamicResource ButtonBorderBrush}"></Border>
<WrapPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Left" Margin="5 0 5 5"> <WrapPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Left" Margin="5 0 5 5">
<controls:HyperlinkButton Classes="icon-button" <controls:HyperlinkButton Classes="icon-button"
Width="44" Width="44"

View File

@ -44,6 +44,7 @@
</TextBox> </TextBox>
<TextBlock Classes="h4" Text="{CompiledBinding TestValue}"/> <TextBlock Classes="h4" Text="{CompiledBinding TestValue}"/>
<controls1:NumberBox Value="{CompiledBinding TestValue}"/>
<controls:DraggableNumberBox Value="{CompiledBinding TestValue}"/> <controls:DraggableNumberBox Value="{CompiledBinding TestValue}"/>
<controls:DraggableNumberBox Value="{CompiledBinding TestValue}" Classes="condensed"/> <controls:DraggableNumberBox Value="{CompiledBinding TestValue}" Classes="condensed"/>

View File

@ -3,7 +3,7 @@
xmlns:styling="clr-namespace:FluentAvalonia.Styling;assembly=FluentAvalonia" xmlns:styling="clr-namespace:FluentAvalonia.Styling;assembly=FluentAvalonia"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"> xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia">
<!-- Third party styles --> <!-- Third party styles -->
<styling:FluentAvaloniaTheme PreferSystemTheme="False" RequestedTheme="Dark"/> <styling:FluentAvaloniaTheme PreferSystemTheme="False" PreferUserAccentColor="True"/>
<avalonia:MaterialIconStyles /> <avalonia:MaterialIconStyles />
<!-- <FluentTheme Mode="Dark"></FluentTheme> --> <!-- <FluentTheme Mode="Dark"></FluentTheme> -->