mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
style<Launcher>: supports two size rules for tabs in titlebar - fixed width or size to content
This commit is contained in:
parent
e3a7abe776
commit
7b70951c93
6 changed files with 40 additions and 10 deletions
|
@ -2,8 +2,27 @@ using Avalonia;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using System;
|
||||
|
||||
namespace SourceGit.Views {
|
||||
public class LauncherTab : Grid {
|
||||
public static readonly StyledProperty<bool> UseFixedTabWidthProperty =
|
||||
AvaloniaProperty.Register<LauncherTab, bool>(nameof(UseFixedTabWidth), false);
|
||||
|
||||
public bool UseFixedTabWidth {
|
||||
get => GetValue(UseFixedTabWidthProperty);
|
||||
set => SetValue(UseFixedTabWidthProperty, value);
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride => typeof(Grid);
|
||||
|
||||
static LauncherTab() {
|
||||
UseFixedTabWidthProperty.Changed.AddClassHandler<LauncherTab>((tab, ev) => {
|
||||
tab.Width = tab.UseFixedTabWidth ? 200.0 : double.NaN;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Launcher : Window, Models.INotificationReceiver {
|
||||
public Launcher() {
|
||||
DataContext = new ViewModels.Launcher();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue