-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for document window drag events
- Loading branch information
1 parent
3b40c50
commit 3b027ae
Showing
6 changed files
with
128 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<Styles xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:idc="using:Dock.Avalonia.Controls"> | ||
<Design.PreviewWith> | ||
<Border> | ||
<idc:HostWindowTitleBar Background="SkyBlue" Height="30" Width="300" Foreground="Black" /> | ||
</Border> | ||
</Design.PreviewWith> | ||
<Style Selector="idc|HostWindowTitleBar"> | ||
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/> | ||
<Setter Property="VerticalAlignment" Value="Top" /> | ||
<Setter Property="HorizontalAlignment" Value="Stretch" /> | ||
<Setter Property="Background" Value="Transparent" /> | ||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<Panel HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="Stretch"> | ||
<Panel x:Name="PART_MouseTracker" Height="1" VerticalAlignment="Top" /> | ||
<Panel x:Name="PART_Container"> | ||
<Border x:Name="PART_Background" Background="{TemplateBinding Background}" /> | ||
<CaptionButtons x:Name="PART_CaptionButtons" VerticalAlignment="Top" HorizontalAlignment="Right" Foreground="{TemplateBinding Foreground}" /> | ||
</Panel> | ||
</Panel> | ||
</ControlTemplate> | ||
</Setter> | ||
</Style> | ||
<Style Selector="idc|HostWindowTitleBar:fullscreen"> | ||
<Setter Property="Background" Value="{DynamicResource SystemAccentColor}" /> | ||
</Style> | ||
<Style Selector="idc|HostWindowTitleBar /template/ Border#PART_Background"> | ||
<Setter Property="IsHitTestVisible" Value="False" /> | ||
</Style> | ||
<Style Selector="idc|HostWindowTitleBar:fullscreen /template/ Border#PART_Background"> | ||
<Setter Property="IsHitTestVisible" Value="True" /> | ||
</Style> | ||
<Style Selector="idc|HostWindowTitleBar:fullscreen /template/ Panel#PART_MouseTracker"> | ||
<Setter Property="Background" Value="Transparent" /> | ||
</Style> | ||
<Style Selector="idc|HostWindowTitleBar:fullscreen /template/ Panel#PART_Container"> | ||
<Setter Property="RenderTransform" Value="translateY(-30px)" /> | ||
<Setter Property="Transitions"> | ||
<Transitions> | ||
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:.25" /> | ||
</Transitions> | ||
</Setter> | ||
</Style> | ||
<Style Selector="idc|HostWindowTitleBar:fullscreen:pointerover /template/ Panel#PART_Container"> | ||
<Setter Property="RenderTransform" Value="none" /> | ||
</Style> | ||
</Styles> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using Avalonia.Controls; | ||
using Avalonia.Controls.Chrome; | ||
using Avalonia.Controls.Primitives; | ||
using Avalonia.Styling; | ||
|
||
namespace Dock.Avalonia.Controls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for <see cref="HostWindowTitleBar"/> xaml. | ||
/// </summary> | ||
public class HostWindowTitleBar : TitleBar, IStyleable | ||
{ | ||
internal Control? BackgroundControl { get; private set; } | ||
|
||
Type IStyleable.StyleKey => typeof(HostWindowTitleBar); | ||
|
||
/// <inheritdoc/> | ||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) | ||
{ | ||
base.OnApplyTemplate(e); | ||
|
||
BackgroundControl = e.NameScope.Find<Control>("PART_Background"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters