Browse Source

Merge branch 'master' into feature/extend-client-area-to-decorations

pull/3967/head
danwalmsley 6 years ago
committed by GitHub
parent
commit
6618f1fbb4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      native/Avalonia.Native/src/OSX/window.mm
  2. 4
      readme.md
  3. 3
      samples/ControlCatalog/SideBar.xaml
  4. 1
      src/Avalonia.Controls/TabItem.cs
  5. 69
      src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml
  6. 69
      src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml
  7. 69
      src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml
  8. 73
      src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml
  9. 117
      src/Avalonia.Themes.Fluent/TabControl.xaml
  10. 173
      src/Avalonia.Themes.Fluent/TabItem.xaml
  11. 14
      src/Avalonia.Themes.Fluent/TabStrip.xaml
  12. 110
      src/Avalonia.Themes.Fluent/TabStripItem.xaml

37
native/Avalonia.Native/src/OSX/window.mm

@ -1312,7 +1312,11 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
_lastPixelSize.Width = (int)fsize.width; _lastPixelSize.Width = (int)fsize.width;
_lastPixelSize.Height = (int)fsize.height; _lastPixelSize.Height = (int)fsize.height;
[self updateRenderTarget]; [self updateRenderTarget];
_parent->BaseEvents->ScalingChanged([_parent->Window backingScaleFactor]);
if(_parent != nullptr)
{
_parent->BaseEvents->ScalingChanged([_parent->Window backingScaleFactor]);
}
[super viewDidChangeBackingProperties]; [super viewDidChangeBackingProperties];
} }
@ -1371,7 +1375,12 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
auto modifiers = [self getModifiers:[event modifierFlags]]; auto modifiers = [self getModifiers:[event modifierFlags]];
[self becomeFirstResponder]; [self becomeFirstResponder];
_parent->BaseEvents->RawMouseEvent(type, timestamp, modifiers, point, delta);
if(_parent != nullptr)
{
_parent->BaseEvents->RawMouseEvent(type, timestamp, modifiers, point, delta);
}
[super mouseMoved:event]; [super mouseMoved:event];
} }
@ -1495,7 +1504,10 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
auto timestamp = [event timestamp] * 1000; auto timestamp = [event timestamp] * 1000;
auto modifiers = [self getModifiers:[event modifierFlags]]; 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 - (BOOL)performKeyEquivalent:(NSEvent *)event
@ -1586,7 +1598,10 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
{ {
if(!_lastKeyHandled) if(!_lastKeyHandled)
{ {
_lastKeyHandled = _parent->BaseEvents->RawTextInputEvent(0, [string UTF8String]); if(_parent != nullptr)
{
_lastKeyHandled = _parent->BaseEvents->RawTextInputEvent(0, [string UTF8String]);
}
} }
} }
@ -1911,7 +1926,11 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
{ {
[self showWindowMenuWithAppMenu]; [self showWindowMenuWithAppMenu];
_parent->BaseEvents->Activated(); if(_parent != nullptr)
{
_parent->BaseEvents->Activated();
}
[super becomeKeyWindow]; [super becomeKeyWindow];
} }
} }
@ -2028,8 +2047,12 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
- (void)windowDidMove:(NSNotification *)notification - (void)windowDidMove:(NSNotification *)notification
{ {
AvnPoint position; AvnPoint position;
_parent->GetPosition(&position);
_parent->BaseEvents->PositionChanged(position); if(_parent != nullptr)
{
_parent->GetPosition(&position);
_parent->BaseEvents->PositionChanged(position);
}
} }
@end @end

4
readme.md

@ -31,7 +31,9 @@ Install-Package Avalonia.Desktop
Examples of UIs built with Avalonia 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/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) ![image](https://user-images.githubusercontent.com/4672627/84708947-c3b98980-af37-11ea-8c9d-503334615bbf.png)

3
samples/ControlCatalog/SideBar.xaml

@ -67,6 +67,9 @@
<Setter Property="(ScrollViewer.HorizontalScrollBarVisibility)" Value="Auto"/> <Setter Property="(ScrollViewer.HorizontalScrollBarVisibility)" Value="Auto"/>
<Setter Property="(ScrollViewer.VerticalScrollBarVisibility)" Value="Auto"/> <Setter Property="(ScrollViewer.VerticalScrollBarVisibility)" Value="Auto"/>
</Style> </Style>
<Style Selector="TabControl.sidebar > TabItem:selected /template/ Border#PART_SelectedPipe">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="TabControl.sidebar > TabItem:pointerover"> <Style Selector="TabControl.sidebar > TabItem:pointerover">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
</Style> </Style>

1
src/Avalonia.Controls/TabItem.cs

@ -26,6 +26,7 @@ namespace Avalonia.Controls
static TabItem() static TabItem()
{ {
SelectableMixin.Attach<TabItem>(IsSelectedProperty); SelectableMixin.Attach<TabItem>(IsSelectedProperty);
PressedMixin.Attach<TabItem>();
FocusableProperty.OverrideDefaultValue(typeof(TabItem), true); FocusableProperty.OverrideDefaultValue(typeof(TabItem), true);
DataContextProperty.Changed.AddClassHandler<TabItem>((x, e) => x.UpdateHeader(e)); DataContextProperty.Changed.AddClassHandler<TabItem>((x, e) => x.UpdateHeader(e));
} }

69
src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml

@ -402,5 +402,74 @@
<SolidColorBrush x:Key="ToolTipBackgroundThemeBrush" Color="#FFFFFFFF" /> <SolidColorBrush x:Key="ToolTipBackgroundThemeBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" /> <SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" />
<SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" /> <SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" />
<!-- Resources for Pivot.xaml -->
<FontFamily x:Key="PivotHeaderItemFontFamily">XamlAutoFontFamily</FontFamily>
<FontFamily x:Key="PivotTitleFontFamily">XamlAutoFontFamily</FontFamily>
<x:Double x:Key="PivotHeaderItemFontSize">24</x:Double>
<x:Double x:Key="PivotHeaderItemLockedTranslation">40</x:Double>
<x:Double x:Key="PivotTitleFontSize">14</x:Double>
<x:Int32 x:Key="PivotHeaderItemCharacterSpacing">-25</x:Int32>
<Thickness x:Key="PivotHeaderItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotLandscapeThemePadding">12,14,0,13</Thickness>
<Thickness x:Key="PivotNavButtonBorderThemeThickness">0</Thickness>
<Thickness x:Key="PivotNavButtonMargin">0,6,0,0</Thickness>
<Thickness x:Key="PivotPortraitThemePadding">12,14,0,13</Thickness>
<FontWeight x:Key="PivotHeaderItemThemeFontWeight">SemiLight</FontWeight>
<FontWeight x:Key="PivotTitleThemeFontWeight">Bold</FontWeight>
<StaticResource x:Key="PivotBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<!-- Resources for PivotItem -->
<StaticResource x:Key="PivotItemBackground" ResourceKey="SystemControlTransparentBrush" />
<!-- Resources for PivotHeaderItem -->
<StaticResource x:Key="PivotHeaderItemBackgroundUnselected" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelected" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundDisabled" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselected" ResourceKey="SystemControlForegroundBaseMediumBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelected" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="PivotHeaderItemFocusPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<StaticResource x:Key="PivotHeaderItemSelectedPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<SolidColorBrush x:Key="PivotForegroundThemeBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="PivotHeaderBackgroundSelectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderBackgroundUnselectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderForegroundSelectedBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="PivotHeaderForegroundUnselectedBrush" Color="#66FFFFFF" />
<SolidColorBrush x:Key="PivotNavButtonBackgroundThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonBorderThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonForegroundThemeBrush" Color="#99000000" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBackgroundThemeBrush" Color="#F0D7D7D7" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBorderThemeBrush" Color="#9EC1C1C1" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverForegroundThemeBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotNavButtonPressedBackgroundThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedBorderThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedForegroundThemeBrush" Color="#FFFFFFFF" />
</Style.Resources> </Style.Resources>
</Style> </Style>

69
src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml

@ -404,5 +404,74 @@
<SolidColorBrush x:Key="ToolTipBackgroundThemeBrush" Color="#FFFFFFFF" /> <SolidColorBrush x:Key="ToolTipBackgroundThemeBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" /> <SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" />
<SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" /> <SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" />
<!-- Resources for Pivot.xaml -->
<FontFamily x:Key="PivotHeaderItemFontFamily">XamlAutoFontFamily</FontFamily>
<FontFamily x:Key="PivotTitleFontFamily">XamlAutoFontFamily</FontFamily>
<x:Double x:Key="PivotHeaderItemFontSize">24</x:Double>
<x:Double x:Key="PivotHeaderItemLockedTranslation">40</x:Double>
<x:Double x:Key="PivotTitleFontSize">14</x:Double>
<x:Int32 x:Key="PivotHeaderItemCharacterSpacing">-25</x:Int32>
<Thickness x:Key="PivotHeaderItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotLandscapeThemePadding">12,14,0,13</Thickness>
<Thickness x:Key="PivotNavButtonBorderThemeThickness">0</Thickness>
<Thickness x:Key="PivotNavButtonMargin">0,6,0,0</Thickness>
<Thickness x:Key="PivotPortraitThemePadding">12,14,0,13</Thickness>
<FontWeight x:Key="PivotHeaderItemThemeFontWeight">SemiLight</FontWeight>
<FontWeight x:Key="PivotTitleThemeFontWeight">Bold</FontWeight>
<StaticResource x:Key="PivotBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<!-- Resources for PivotItem -->
<StaticResource x:Key="PivotItemBackground" ResourceKey="SystemControlTransparentBrush" />
<!-- Resources for PivotHeaderItem -->
<StaticResource x:Key="PivotHeaderItemBackgroundUnselected" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelected" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundDisabled" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselected" ResourceKey="SystemControlForegroundBaseMediumBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelected" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="PivotHeaderItemFocusPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<StaticResource x:Key="PivotHeaderItemSelectedPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<SolidColorBrush x:Key="PivotForegroundThemeBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotHeaderBackgroundSelectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderBackgroundUnselectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderForegroundSelectedBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotHeaderForegroundUnselectedBrush" Color="#66000000" />
<SolidColorBrush x:Key="PivotNavButtonBackgroundThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonBorderThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonForegroundThemeBrush" Color="#99000000" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBackgroundThemeBrush" Color="#F0D7D7D7" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBorderThemeBrush" Color="#9EC1C1C1" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverForegroundThemeBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotNavButtonPressedBackgroundThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedBorderThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedForegroundThemeBrush" Color="#FFFFFFFF" />
</Style.Resources> </Style.Resources>
</Style> </Style>

69
src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml

@ -657,5 +657,74 @@
<SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" /> <SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" />
<SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" /> <SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" />
<Thickness x:Key="ToolTipBorderThemePadding">8,5,8,7</Thickness> <Thickness x:Key="ToolTipBorderThemePadding">8,5,8,7</Thickness>
<!-- Resources for Pivot.xaml -->
<FontFamily x:Key="PivotHeaderItemFontFamily">XamlAutoFontFamily</FontFamily>
<FontFamily x:Key="PivotTitleFontFamily">XamlAutoFontFamily</FontFamily>
<x:Double x:Key="PivotHeaderItemFontSize">24</x:Double>
<x:Double x:Key="PivotHeaderItemLockedTranslation">40</x:Double>
<x:Double x:Key="PivotTitleFontSize">14</x:Double>
<x:Int32 x:Key="PivotHeaderItemCharacterSpacing">-25</x:Int32>
<Thickness x:Key="PivotHeaderItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotLandscapeThemePadding">12,14,0,13</Thickness>
<Thickness x:Key="PivotNavButtonBorderThemeThickness">0</Thickness>
<Thickness x:Key="PivotNavButtonMargin">0,6,0,0</Thickness>
<Thickness x:Key="PivotPortraitThemePadding">12,14,0,13</Thickness>
<FontWeight x:Key="PivotHeaderItemThemeFontWeight">SemiLight</FontWeight>
<FontWeight x:Key="PivotTitleThemeFontWeight">Bold</FontWeight>
<StaticResource x:Key="PivotBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<!-- Resources for PivotItem -->
<StaticResource x:Key="PivotItemBackground" ResourceKey="SystemControlTransparentBrush" />
<!-- Resources for PivotHeaderItem -->
<StaticResource x:Key="PivotHeaderItemBackgroundUnselected" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelected" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundDisabled" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselected" ResourceKey="SystemControlForegroundBaseMediumBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelected" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="PivotHeaderItemFocusPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<StaticResource x:Key="PivotHeaderItemSelectedPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<SolidColorBrush x:Key="PivotForegroundThemeBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="PivotHeaderBackgroundSelectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderBackgroundUnselectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderForegroundSelectedBrush" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="PivotHeaderForegroundUnselectedBrush" Color="#66FFFFFF" />
<SolidColorBrush x:Key="PivotNavButtonBackgroundThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonBorderThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonForegroundThemeBrush" Color="#99000000" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBackgroundThemeBrush" Color="#F0D7D7D7" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBorderThemeBrush" Color="#9EC1C1C1" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverForegroundThemeBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotNavButtonPressedBackgroundThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedBorderThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedForegroundThemeBrush" Color="#FFFFFFFF" />
</Style.Resources> </Style.Resources>
</Style> </Style>

73
src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml

@ -366,8 +366,8 @@
<x:Double x:Key="AutoCompleteBoxIconFontSize">12</x:Double> <x:Double x:Key="AutoCompleteBoxIconFontSize">12</x:Double>
<!-- Resources for CheckBox.xaml --> <!-- Resources for CheckBox.xaml -->
<x:Double x:Key="CheckBoxBorderThemeThickness">1</x:Double> <Thickness x:Key="CheckBoxBorderThemeThickness">1</Thickness>
<x:Double x:Key="CheckBoxCheckedStrokeThickness">0</x:Double> <Thickness x:Key="CheckBoxCheckedStrokeThickness">0</Thickness>
<StaticResource x:Key="CheckBoxForegroundUnchecked" ResourceKey="SystemControlForegroundBaseHighBrush" /> <StaticResource x:Key="CheckBoxForegroundUnchecked" ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CheckBoxForegroundUncheckedPointerOver" ResourceKey="SystemControlForegroundBaseHighBrush" /> <StaticResource x:Key="CheckBoxForegroundUncheckedPointerOver" ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CheckBoxForegroundUncheckedPressed" ResourceKey="SystemControlForegroundBaseHighBrush" /> <StaticResource x:Key="CheckBoxForegroundUncheckedPressed" ResourceKey="SystemControlForegroundBaseHighBrush" />
@ -655,5 +655,74 @@
<SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" /> <SolidColorBrush x:Key="ToolTipBorderThemeBrush" Color="#FF808080" />
<SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" /> <SolidColorBrush x:Key="ToolTipForegroundThemeBrush" Color="#FF666666" />
<Thickness x:Key="ToolTipBorderThemePadding">8,5,8,7</Thickness> <Thickness x:Key="ToolTipBorderThemePadding">8,5,8,7</Thickness>
<!-- Resources for Pivot.xaml -->
<FontFamily x:Key="PivotHeaderItemFontFamily">XamlAutoFontFamily</FontFamily>
<FontFamily x:Key="PivotTitleFontFamily">XamlAutoFontFamily</FontFamily>
<x:Double x:Key="PivotHeaderItemFontSize">24</x:Double>
<x:Double x:Key="PivotHeaderItemLockedTranslation">40</x:Double>
<x:Double x:Key="PivotTitleFontSize">14</x:Double>
<x:Int32 x:Key="PivotHeaderItemCharacterSpacing">-25</x:Int32>
<Thickness x:Key="PivotHeaderItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotItemMargin">12,0,12,0</Thickness>
<Thickness x:Key="PivotLandscapeThemePadding">12,14,0,13</Thickness>
<Thickness x:Key="PivotNavButtonBorderThemeThickness">0</Thickness>
<Thickness x:Key="PivotNavButtonMargin">0,6,0,0</Thickness>
<Thickness x:Key="PivotPortraitThemePadding">12,14,0,13</Thickness>
<FontWeight x:Key="PivotHeaderItemThemeFontWeight">SemiLight</FontWeight>
<FontWeight x:Key="PivotTitleThemeFontWeight">Bold</FontWeight>
<StaticResource x:Key="PivotBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderBackground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotNextButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotNextButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotNextButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBackground" ResourceKey="SystemControlBackgroundBaseMediumLowBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPointerOver" ResourceKey="SystemControlHighlightBaseMediumBrush" />
<StaticResource x:Key="PivotPreviousButtonBackgroundPressed" ResourceKey="SystemControlHighlightBaseMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPointerOver" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonBorderBrushPressed" ResourceKey="SystemControlForegroundTransparentBrush" />
<StaticResource x:Key="PivotPreviousButtonForeground" ResourceKey="SystemControlForegroundAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<StaticResource x:Key="PivotPreviousButtonForegroundPressed" ResourceKey="SystemControlHighlightAltAltMediumHighBrush" />
<!-- Resources for PivotItem -->
<StaticResource x:Key="PivotItemBackground" ResourceKey="SystemControlTransparentBrush" />
<!-- Resources for PivotHeaderItem -->
<StaticResource x:Key="PivotHeaderItemBackgroundUnselected" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundUnselectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelected" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPointerOver" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundSelectedPressed" ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemBackgroundDisabled" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselected" ResourceKey="SystemControlForegroundBaseMediumBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundUnselectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelected" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPointerOver" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundSelectedPressed" ResourceKey="SystemControlHighlightAltBaseMediumHighBrush" />
<StaticResource x:Key="PivotHeaderItemForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="PivotHeaderItemFocusPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<StaticResource x:Key="PivotHeaderItemSelectedPipeFill" ResourceKey="SystemControlHighlightAltAccentBrush" />
<SolidColorBrush x:Key="PivotForegroundThemeBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotHeaderBackgroundSelectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderBackgroundUnselectedBrush" Color="Transparent" />
<SolidColorBrush x:Key="PivotHeaderForegroundSelectedBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotHeaderForegroundUnselectedBrush" Color="#66000000" />
<SolidColorBrush x:Key="PivotNavButtonBackgroundThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonBorderThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="PivotNavButtonForegroundThemeBrush" Color="#99000000" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBackgroundThemeBrush" Color="#F0D7D7D7" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverBorderThemeBrush" Color="#9EC1C1C1" />
<SolidColorBrush x:Key="PivotNavButtonPointerOverForegroundThemeBrush" Color="#FF000000" />
<SolidColorBrush x:Key="PivotNavButtonPressedBackgroundThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedBorderThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="PivotNavButtonPressedForegroundThemeBrush" Color="#FFFFFFFF" />
</Style.Resources> </Style.Resources>
</Style> </Style>

117
src/Avalonia.Themes.Fluent/TabControl.xaml

@ -1,62 +1,61 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Styles xmlns="https://github.com/avaloniaui"
<Style Selector="TabControl"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Template"> <Design.PreviewWith>
<ControlTemplate> <Border Width="400">
<Border <TabControl>
Margin="{TemplateBinding Margin}" <TabItem Header="Arch">
BorderBrush="{TemplateBinding BorderBrush}" <Border Background="AntiqueWhite"
BorderThickness="{TemplateBinding BorderThickness}" Height="100">
Background="{TemplateBinding Background}" <TextBlock Text="Content" Foreground="Black" FontSize="20"/>
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" </Border>
VerticalAlignment="{TemplateBinding VerticalAlignment}"> </TabItem>
<DockPanel> <TabItem Header="Leaf">
<ItemsPresenter <Border Background="Green"
Name="PART_ItemsPresenter" Height="100" />
</TabItem>
<TabItem Header="Disabled"
IsEnabled="False" />
</TabControl>
</Border>
</Design.PreviewWith>
<Style Selector="TabControl">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="{DynamicResource PivotItemMargin}" />
<Setter Property="Background" Value="{DynamicResource PivotBackground}" />
<Setter Property="Template">
<ControlTemplate>
<Border Margin="{TemplateBinding Margin}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<DockPanel>
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"> ItemTemplate="{TemplateBinding ItemTemplate}"
</ItemsPresenter> DockPanel.Dock="{TemplateBinding TabStripPlacement}"/>
<ContentPresenter <ContentPresenter Name="PART_SelectedContentHost"
Name="PART_SelectedContentHost" Margin="{TemplateBinding Padding}"
Margin="{TemplateBinding Padding}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding SelectedContent}"
Content="{TemplateBinding SelectedContent}" ContentTemplate="{TemplateBinding SelectedContentTemplate}" />
ContentTemplate="{TemplateBinding SelectedContentTemplate}"> </DockPanel>
</ContentPresenter> </Border>
</DockPanel> </ControlTemplate>
</Border> </Setter>
</ControlTemplate> </Style>
</Setter>
</Style> <Style Selector="TabControl[TabStripPlacement=Left] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel">
<Style Selector="TabControl[TabStripPlacement=Top]"> <Setter Property="Orientation" Value="Vertical" />
<Setter Property="Padding" Value="0 4 0 0"/> </Style>
</Style> <Style Selector="TabControl[TabStripPlacement=Right] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel">
<Style Selector="TabControl[TabStripPlacement=Top] /template/ ItemsPresenter#PART_ItemsPresenter"> <Setter Property="Orientation" Value="Vertical" />
<Setter Property="DockPanel.Dock" Value="Top"/> </Style>
</Style> <Style Selector="TabControl[TabStripPlacement=Top] /template/ ItemsPresenter#PART_ItemsPresenter">
<Style Selector="TabControl[TabStripPlacement=Bottom] /template/ ItemsPresenter#PART_ItemsPresenter"> <Setter Property="Margin" Value="0 0 0 2" />
<Setter Property="DockPanel.Dock" Value="Bottom"/> </Style>
</Style>
<Style Selector="TabControl[TabStripPlacement=Bottom]">
<Setter Property="Padding" Value="0 0 0 4"/>
</Style>
<Style Selector="TabControl[TabStripPlacement=Left] /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="DockPanel.Dock" Value="Left"/>
</Style>
<Style Selector="TabControl[TabStripPlacement=Left] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel">
<Setter Property="Orientation" Value="Vertical"/>
</Style>
<Style Selector="TabControl[TabStripPlacement=Left]">
<Setter Property="Padding" Value="4 0 0 0"/>
</Style>
<Style Selector="TabControl[TabStripPlacement=Right] /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="DockPanel.Dock" Value="Right"/>
</Style>
<Style Selector="TabControl[TabStripPlacement=Right] /template/ ItemsPresenter#PART_ItemsPresenter > WrapPanel">
<Setter Property="Orientation" Value="Vertical"/>
</Style>
<Style Selector="TabControl[TabStripPlacement=Right]">
<Setter Property="Padding" Value="0 0 4 0"/>
</Style>
</Styles> </Styles>

173
src/Avalonia.Themes.Fluent/TabItem.xaml

@ -1,45 +1,130 @@
<Styles xmlns="https://github.com/avaloniaui"> <Styles xmlns="https://github.com/avaloniaui"
<Style Selector="TabItem"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="Transparent"/> <Design.PreviewWith>
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/> <Border Padding="20">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLightBrush}"/> <StackPanel Spacing="20">
<Setter Property="HorizontalContentAlignment" Value="Left"/> <TabItem Header="Leaf" />
<Setter Property="Padding" Value="8"/> <TabItem Header="Arch" IsSelected="True" />
<Setter Property="Template"> </StackPanel>
<ControlTemplate> </Border>
<ContentPresenter </Design.PreviewWith>
Name="PART_ContentPresenter" <Styles.Resources>
Background="{TemplateBinding Background}" <x:Double x:Key="TabItemMinHeight">48</x:Double>
BorderBrush="{TemplateBinding BorderBrush}" <x:Double x:Key="TabItemVerticalPipeHeight">24</x:Double>
BorderThickness="{TemplateBinding BorderThickness}" <x:Double x:Key="TabItemPipeThickness">2</x:Double>
ContentTemplate="{TemplateBinding HeaderTemplate}" </Styles.Resources>
Content="{TemplateBinding Header}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" <Style Selector="TabItem">
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" <Setter Property="FontSize" Value="{DynamicResource PivotHeaderItemFontSize}" />
Margin="{TemplateBinding Margin}" <Setter Property="FontWeight" Value="{DynamicResource PivotHeaderItemThemeFontWeight}" />
Padding="{TemplateBinding Padding}"/> <Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselected}" />
</ControlTemplate> <Setter Property="Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselected}" />
</Setter> <Setter Property="Padding" Value="{DynamicResource PivotHeaderItemMargin}" />
</Style> <Setter Property="Margin" Value="0" />
<Style Selector="TabItem:disabled"> <Setter Property="MinHeight" Value="{DynamicResource TabItemMinHeight}" />
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> <Setter Property="VerticalContentAlignment" Value="Center" />
</Style> <Setter Property="Template">
<Style Selector="TabItem:pointerover"> <ControlTemplate>
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> <Border Name="PART_LayoutRoot"
</Style> BorderBrush="{TemplateBinding BorderBrush}"
<Style Selector="TabItem:selected"> BorderThickness="{TemplateBinding BorderThickness}"
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> Padding="{TemplateBinding Padding}">
</Style> <Panel>
<Style Selector="TabItem:selected:focus"> <ContentPresenter Name="PART_ContentPresenter"
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> ContentTemplate="{TemplateBinding HeaderTemplate}"
</Style> Content="{TemplateBinding Header}"
<Style Selector="TabItem:selected:pointerover"> HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
</Style> TextBlock.FontFamily="{TemplateBinding FontFamily}"
<Style Selector="TabItem:selected:focus:pointerover"> TextBlock.FontSize="{TemplateBinding FontSize}"
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/> TextBlock.FontWeight="{TemplateBinding FontWeight}" />
</Style> <Border Name="PART_SelectedPipe"
<Style Selector="TabItem[TabStripPlacement=Right]"> CornerRadius="{DynamicResource ControlCornerRadius}"
<Setter Property="HorizontalContentAlignment" Value="Right"/> Background="{DynamicResource PivotHeaderItemSelectedPipeFill}" />
</Style> </Panel>
</Border>
</ControlTemplate>
</Setter>
</Style>
<!-- Nornal state -->
<Style Selector="TabItem /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{Binding $parent[TabItem].Background}" />
</Style>
<Style Selector="TabItem /template/ Border#PART_SelectedPipe">
<Setter Property="IsVisible" Value="False" />
</Style>
<!-- Selected state -->
<!-- We don't use selector to PART_LayoutRoot, so developer can override selected item background with TabStripItem.Background -->
<Style Selector="TabItem:selected">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelected}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelected}" />
</Style>
<Style Selector="TabItem:selected /template/ Border#PART_SelectedPipe">
<Setter Property="IsVisible" Value="True" />
</Style>
<!-- PointerOver state -->
<Style Selector="TabItem:pointerover /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselectedPointerOver}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselectedPointerOver}" />
</Style>
<!-- Selected PointerOver state -->
<Style Selector="TabItem:selected:pointerover /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelectedPointerOver}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelectedPointerOver}" />
</Style>
<!-- Pressed state -->
<Style Selector="TabItem:pressed /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselectedPressed}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselectedPressed}" />
</Style>
<!-- Selected Pressed state -->
<Style Selector="TabItem:pressed /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelectedPressed}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelectedPressed}" />
</Style>
<!-- Disabled state -->
<Style Selector="TabItem:disabled /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundDisabled}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundDisabled}" />
</Style>
<!-- TabStripPlacement States Group -->
<Style Selector="TabItem[TabStripPlacement=Left] /template/ Border#PART_SelectedPipe">
<Setter Property="Width" Value="{StaticResource TabItemPipeThickness}" />
<Setter Property="Height" Value="{StaticResource TabItemVerticalPipeHeight}" />
<Setter Property="Margin" Value="0,0,2,0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="TabItem[TabStripPlacement=Left] /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Margin" Value="8,0,0,0" />
</Style>
<Style Selector="TabItem[TabStripPlacement=Top] /template/ Border#PART_SelectedPipe, TabItem[TabStripPlacement=Bottom] /template/ Border#PART_SelectedPipe">
<Setter Property="Height" Value="{StaticResource TabItemPipeThickness}" />
<Setter Property="Margin" Value="0,0,0,2" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<Style Selector="TabItem[TabStripPlacement=Right] /template/ Border#PART_SelectedPipe">
<Setter Property="Width" Value="{StaticResource TabItemPipeThickness}" />
<Setter Property="Height" Value="{StaticResource TabItemVerticalPipeHeight}" />
<Setter Property="Margin" Value="2,0,0,0" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="TabItem[TabStripPlacement=Right] /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Margin" Value="0,0,8,0" />
</Style>
<Style Selector="TabItem[TabStripPlacement=Right]">
<Setter Property="HorizontalContentAlignment" Value="Right" />
</Style>
</Styles> </Styles>

14
src/Avalonia.Themes.Fluent/TabStrip.xaml

@ -1,11 +1,20 @@
<Styles xmlns="https://github.com/avaloniaui"> <Styles xmlns="https://github.com/avaloniaui">
<Design.PreviewWith>
<Border Padding="20">
<TabStrip>
<TabStripItem>Item 1</TabStripItem>
<TabStripItem>Item 2</TabStripItem>
<TabStripItem IsEnabled="False">Disabled</TabStripItem>
</TabStrip>
</Border>
</Design.PreviewWith>
<Style Selector="TabStrip"> <Style Selector="TabStrip">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}" ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"/> ItemTemplate="{TemplateBinding ItemTemplate}" />
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Setter Property="ItemsPanel"> <Setter Property="ItemsPanel">
@ -14,7 +23,4 @@
</ItemsPanelTemplate> </ItemsPanelTemplate>
</Setter> </Setter>
</Style> </Style>
<Style Selector="TabStrip > TabStripItem">
<Setter Property="Margin" Value="16"/>
</Style>
</Styles> </Styles>

110
src/Avalonia.Themes.Fluent/TabStripItem.xaml

@ -1,23 +1,103 @@
<Styles xmlns="https://github.com/avaloniaui"> <Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<Border Padding="20">
<StackPanel Spacing="20">
<TabStripItem>Leaf</TabStripItem>
<TabStripItem IsSelected="True">Arch</TabStripItem>
</StackPanel>
</Border>
</Design.PreviewWith>
<Styles.Resources>
<x:Double x:Key="TabStripItemMinHeight">48</x:Double>
<x:Double x:Key="TabStripItemPipeThickness">2</x:Double>
</Styles.Resources>
<Style Selector="TabStripItem"> <Style Selector="TabStripItem">
<Setter Property="Background" Value="Transparent"/> <Setter Property="FontSize" Value="{DynamicResource PivotHeaderItemFontSize}" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/> <Setter Property="FontWeight" Value="{DynamicResource PivotHeaderItemThemeFontWeight}" />
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/> <Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselected}" />
<Setter Property="Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselected}" />
<Setter Property="Padding" Value="{DynamicResource PivotHeaderItemMargin}" />
<Setter Property="Margin" Value="0" />
<Setter Property="MinHeight" Value="{DynamicResource TabStripItemMinHeight}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <Border Name="PART_LayoutRoot"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
ContentTemplate="{TemplateBinding ContentTemplate}" <Panel>
Content="{TemplateBinding Content}" <ContentPresenter Name="PART_ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}"/> HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextBlock.FontFamily="{TemplateBinding FontFamily}"
TextBlock.FontSize="{TemplateBinding FontSize}"
TextBlock.FontWeight="{TemplateBinding FontWeight}" />
<Border Name="PART_SelectedPipe"
CornerRadius="{DynamicResource ControlCornerRadius}"
Background="{DynamicResource PivotHeaderItemSelectedPipeFill}" />
</Panel>
</Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>
<!-- Nornal state -->
<Style Selector="TabStripItem /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{Binding $parent[TabStripItem].Background}" />
</Style>
<Style Selector="TabStripItem /template/ Border#PART_SelectedPipe">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="TabStripItem /template/ Border#PART_SelectedPipe, TabItem[TabStripPlacement=Bottom] /template/ Border#PART_SelectedPipe">
<Setter Property="Height" Value="{StaticResource TabStripItemPipeThickness}" />
<Setter Property="Margin" Value="0,0,0,2" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<!-- Selected state -->
<!-- We don't use selector to PART_LayoutRoot, so developer can override selected item background with TabStripItem.Background -->
<Style Selector="TabStripItem:selected"> <Style Selector="TabStripItem:selected">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelected}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelected}" />
</Style>
<Style Selector="TabStripItem:selected /template/ Border#PART_SelectedPipe">
<Setter Property="IsVisible" Value="True" />
</Style>
<!-- PointerOver state -->
<Style Selector="TabStripItem:pointerover /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselectedPointerOver}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselectedPointerOver}" />
</Style>
<!-- Selected PointerOver state -->
<Style Selector="TabStripItem:selected:pointerover /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelectedPointerOver}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelectedPointerOver}" />
</Style>
<!-- Pressed state -->
<Style Selector="TabStripItem:pressed /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselectedPressed}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselectedPressed}" />
</Style>
<!-- Selected Pressed state -->
<Style Selector="TabStripItem:pressed /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelectedPressed}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelectedPressed}" />
</Style>
<!-- Disabled state -->
<Style Selector="TabStripItem:disabled /template/ Border#PART_LayoutRoot">
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundDisabled}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundDisabled}" />
</Style> </Style>
</Styles> </Styles>

Loading…
Cancel
Save