-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand the TitleBar on touch when the title can't fit in one line
- Loading branch information
1 parent
76c97e7
commit 107fc67
Showing
3 changed files
with
43 additions
and
18 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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
// Copyright (c) Davide Pierotti <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using System.Windows.Input; | ||
|
||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Controls.Primitives; | ||
using Avalonia.Controls.Templates; | ||
using Avalonia.Media; | ||
|
||
namespace Aosta.Ava.Controls; | ||
|
||
|
@@ -55,5 +59,19 @@ public ICommand MenuCommand | |
get => GetValue(MenuCommandProperty); | ||
set => SetValue(MenuCommandProperty, value); | ||
} | ||
} | ||
|
||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) | ||
{ | ||
base.OnApplyTemplate(e); | ||
|
||
var textBlock = this.GetTemplateChildren() | ||
.OfType<TextBlock>() | ||
.First(static x => x.Name == "PART_TitleText"); | ||
|
||
Tapped += (_, _) => | ||
{ | ||
// ReSharper disable once BitwiseOperatorOnEnumWithoutFlags | ||
textBlock.TextWrapping ^= TextWrapping.WrapWithOverflow; | ||
}; | ||
} | ||
} |