From 461bf787d89eec2eac8922dce7a673d099f522b5 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 17 Jun 2020 02:43:42 -0400 Subject: [PATCH 1/9] Add pressed mixin to TabItem --- src/Avalonia.Controls/TabItem.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avalonia.Controls/TabItem.cs b/src/Avalonia.Controls/TabItem.cs index 038ea225ce..6320443a13 100644 --- a/src/Avalonia.Controls/TabItem.cs +++ b/src/Avalonia.Controls/TabItem.cs @@ -26,6 +26,7 @@ namespace Avalonia.Controls static TabItem() { SelectableMixin.Attach(IsSelectedProperty); + PressedMixin.Attach(); FocusableProperty.OverrideDefaultValue(typeof(TabItem), true); DataContextProperty.Changed.AddClassHandler((x, e) => x.UpdateHeader(e)); } From 38011f37a735ff47551afa428cd08c5ccdfb5132 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 17 Jun 2020 02:44:01 -0400 Subject: [PATCH 2/9] Add fluent tab control resources --- .../Accents/FluentBaseDark.xaml | 69 +++++++++++++++++++ .../Accents/FluentBaseLight.xaml | 69 +++++++++++++++++++ .../Accents/FluentControlResourcesDark.xaml | 69 +++++++++++++++++++ .../Accents/FluentControlResourcesLight.xaml | 69 +++++++++++++++++++ 4 files changed, 276 insertions(+) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml index ae2218ddde..1ef9ed84c9 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -402,5 +402,74 @@ + + + XamlAutoFontFamily + XamlAutoFontFamily + 24 + 40 + 14 + -25 + 12,0,12,0 + 12,0,12,0 + 12,14,0,13 + 0 + 0,6,0,0 + 12,14,0,13 + SemiLight + Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index 9510875212..9a1ced3db8 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -404,5 +404,74 @@ + + + XamlAutoFontFamily + XamlAutoFontFamily + 24 + 40 + 14 + -25 + 12,0,12,0 + 12,0,12,0 + 12,14,0,13 + 0 + 0,6,0,0 + 12,14,0,13 + SemiLight + Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index eb6cc610cc..b9502daaea 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -657,5 +657,74 @@ 8,5,8,7 + + + XamlAutoFontFamily + XamlAutoFontFamily + 24 + 40 + 14 + -25 + 12,0,12,0 + 12,0,12,0 + 12,14,0,13 + 0 + 0,6,0,0 + 12,14,0,13 + SemiLight + Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index cba20faf7c..fbd300afb4 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -655,5 +655,74 @@ 8,5,8,7 + + + XamlAutoFontFamily + XamlAutoFontFamily + 24 + 40 + 14 + -25 + 12,0,12,0 + 12,0,12,0 + 12,14,0,13 + 0 + 0,6,0,0 + 12,14,0,13 + SemiLight + Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From eee0e13a8d600d87ea013611842c4220f6411c8a Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 17 Jun 2020 02:44:19 -0400 Subject: [PATCH 3/9] Fluent TabStrip style --- src/Avalonia.Themes.Fluent/TabStrip.xaml | 14 ++- src/Avalonia.Themes.Fluent/TabStripItem.xaml | 107 ++++++++++++++++--- 2 files changed, 102 insertions(+), 19 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/TabStrip.xaml b/src/Avalonia.Themes.Fluent/TabStrip.xaml index 29ca1e7c94..8b3c0a8310 100644 --- a/src/Avalonia.Themes.Fluent/TabStrip.xaml +++ b/src/Avalonia.Themes.Fluent/TabStrip.xaml @@ -1,11 +1,20 @@ + + + + Item 1 + Item 2 + Disabled + + + - diff --git a/src/Avalonia.Themes.Fluent/TabStripItem.xaml b/src/Avalonia.Themes.Fluent/TabStripItem.xaml index 28c4c68a3d..93c52b030d 100644 --- a/src/Avalonia.Themes.Fluent/TabStripItem.xaml +++ b/src/Avalonia.Themes.Fluent/TabStripItem.xaml @@ -1,23 +1,100 @@ - + + + + + Leaf + Arch + + + + + 48 + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + From 1faafd608782c235d215115f527a13c5f37c1a43 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 17 Jun 2020 02:44:29 -0400 Subject: [PATCH 4/9] Fluent TabControl style --- src/Avalonia.Themes.Fluent/TabControl.xaml | 117 +++++++------- src/Avalonia.Themes.Fluent/TabItem.xaml | 169 +++++++++++++++------ 2 files changed, 183 insertions(+), 103 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/TabControl.xaml b/src/Avalonia.Themes.Fluent/TabControl.xaml index ed2e67df28..3cfdf60ae0 100644 --- a/src/Avalonia.Themes.Fluent/TabControl.xaml +++ b/src/Avalonia.Themes.Fluent/TabControl.xaml @@ -1,62 +1,61 @@ - - - - - - - - - - - - + ItemTemplate="{TemplateBinding ItemTemplate}" + DockPanel.Dock="{TemplateBinding TabStripPlacement}"/> + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/TabItem.xaml b/src/Avalonia.Themes.Fluent/TabItem.xaml index 92482a564c..55e84f39d8 100644 --- a/src/Avalonia.Themes.Fluent/TabItem.xaml +++ b/src/Avalonia.Themes.Fluent/TabItem.xaml @@ -1,45 +1,126 @@ - - - - - - - - - + + + + + + + + + + + 48 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 74297a9026d9029e200c1792903f57d38524f2cd Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 17 Jun 2020 17:06:03 -0400 Subject: [PATCH 5/9] Fix TabItem height issue --- src/Avalonia.Themes.Fluent/TabItem.xaml | 22 ++++++++++++-------- src/Avalonia.Themes.Fluent/TabStripItem.xaml | 15 +++++++------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/TabItem.xaml b/src/Avalonia.Themes.Fluent/TabItem.xaml index 55e84f39d8..694e86a184 100644 --- a/src/Avalonia.Themes.Fluent/TabItem.xaml +++ b/src/Avalonia.Themes.Fluent/TabItem.xaml @@ -9,7 +9,9 @@ - 48 + 48 + 24 + 2 + From 22f5592f4d16f6828250ebd0939506a366aedd6e Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 17 Jun 2020 17:06:35 -0400 Subject: [PATCH 6/9] Hide PART_SelectedPipe on ControlsCatalog sidebar --- samples/ControlCatalog/SideBar.xaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/ControlCatalog/SideBar.xaml b/samples/ControlCatalog/SideBar.xaml index 26d25a6266..1ee6bf7a29 100644 --- a/samples/ControlCatalog/SideBar.xaml +++ b/samples/ControlCatalog/SideBar.xaml @@ -67,6 +67,9 @@ + From f9289241e06ad847904c5dc357d0ae2964fda06e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 17 Jun 2020 21:27:10 -0300 Subject: [PATCH 7/9] add null checks for _parent. --- native/Avalonia.Native/src/OSX/window.mm | 37 +++++++++++++++++++----- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/window.mm b/native/Avalonia.Native/src/OSX/window.mm index abfae3cf1e..f826df4da9 100644 --- a/native/Avalonia.Native/src/OSX/window.mm +++ b/native/Avalonia.Native/src/OSX/window.mm @@ -1107,7 +1107,11 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent _lastPixelSize.Width = (int)fsize.width; _lastPixelSize.Height = (int)fsize.height; [self updateRenderTarget]; - _parent->BaseEvents->ScalingChanged([_parent->Window backingScaleFactor]); + + if(_parent != nullptr) + { + _parent->BaseEvents->ScalingChanged([_parent->Window backingScaleFactor]); + } [super viewDidChangeBackingProperties]; } @@ -1166,7 +1170,12 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent auto modifiers = [self getModifiers:[event modifierFlags]]; [self becomeFirstResponder]; - _parent->BaseEvents->RawMouseEvent(type, timestamp, modifiers, point, delta); + + if(_parent != nullptr) + { + _parent->BaseEvents->RawMouseEvent(type, timestamp, modifiers, point, delta); + } + [super mouseMoved:event]; } @@ -1290,7 +1299,10 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent auto timestamp = [event timestamp] * 1000; auto modifiers = [self getModifiers:[event modifierFlags]]; - _lastKeyHandled = _parent->BaseEvents->RawKeyEvent(type, timestamp, modifiers, key); + if(_parent != nullptr) + { + _lastKeyHandled = _parent->BaseEvents->RawKeyEvent(type, timestamp, modifiers, key); + } } - (BOOL)performKeyEquivalent:(NSEvent *)event @@ -1381,7 +1393,10 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent { if(!_lastKeyHandled) { - _lastKeyHandled = _parent->BaseEvents->RawTextInputEvent(0, [string UTF8String]); + if(_parent != nullptr) + { + _lastKeyHandled = _parent->BaseEvents->RawTextInputEvent(0, [string UTF8String]); + } } } @@ -1677,7 +1692,11 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent { [self showWindowMenuWithAppMenu]; - _parent->BaseEvents->Activated(); + if(_parent != nullptr) + { + _parent->BaseEvents->Activated(); + } + [super becomeKeyWindow]; } } @@ -1794,8 +1813,12 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent - (void)windowDidMove:(NSNotification *)notification { AvnPoint position; - _parent->GetPosition(&position); - _parent->BaseEvents->PositionChanged(position); + + if(_parent != nullptr) + { + _parent->GetPosition(&position); + _parent->BaseEvents->PositionChanged(position); + } } @end From 7f1a7faebfd8b1dbb756978255e93101bc2c0aa0 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 18 Jun 2020 15:56:19 -0300 Subject: [PATCH 8/9] fix checkbox border not showing on fluent light theme. --- .../Accents/FluentControlResourcesLight.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index fbd300afb4..d16e6b6b55 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -366,8 +366,8 @@ 12 - 1 - 0 + 1 + 0 From 281a87e9de39d8c46529a9de22a28118bcbeadcb Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Thu, 18 Jun 2020 17:43:19 -0300 Subject: [PATCH 9/9] update screenshots. --- readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 9d317cdd06..a9263d4816 100644 --- a/readme.md +++ b/readme.md @@ -31,7 +31,9 @@ Install-Package Avalonia.Desktop Examples of UIs built with Avalonia ![image](https://user-images.githubusercontent.com/4672627/84707589-5b69a880-af35-11ea-87a6-7ad57a31d314.png) -![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) +![image](https://user-images.githubusercontent.com/4672627/85069644-d8419000-b18a-11ea-8732-be9055bb61fd.PNG) + +![image](https://user-images.githubusercontent.com/4672627/85069659-dc6dad80-b18a-11ea-8375-39ef95315b5c.PNG) ![image](https://user-images.githubusercontent.com/4672627/84708947-c3b98980-af37-11ea-8c9d-503334615bbf.png)