Skip to content

Commit 1d7866a

Browse files
committed
[UX] Global Search UI
1 parent 83a44a7 commit 1d7866a

File tree

66 files changed

+915
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+915
-268
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<Styles xmlns="https://github.com/avaloniaui"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:controls="using:WDE.SourceCodeIntegrationEditor.VisualStudioIntegration.Views">
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
43
<Design.PreviewWith>
5-
<controls:BalloonPopup />
4+
<BalloonPopup Content="Abcdefg" ShowTail="True" />
65
</Design.PreviewWith>
76

8-
<Style Selector="controls|BalloonPopup">
7+
<Style Selector="BalloonPopup">
98
<Setter Property="ClipToBounds" Value="False" />
109
<Setter Property="Template">
1110
<ControlTemplate>
1211
<Panel Name="PART_RootPanel">
13-
<Border BoxShadow="0 5 20 2 #40000000" Background="{DynamicResource TeachingTipBackground}"
12+
<Border BoxShadow="0 5 10 2 #40000000" Background="{DynamicResource TeachingTipBackground}"
1413
BorderThickness="1"
14+
ClipToBounds="False"
15+
Margin="10,-1,10,10"
1516
CornerRadius="{DynamicResource ControlCornerRadius}"
1617
BorderBrush="{DynamicResource TeachingTipBorderBrush}" Padding="10">
1718
<ContentPresenter x:Name="PART_ContentPresenter"
@@ -23,21 +24,18 @@
2324
<Path DockPanel.Dock="Top"
2425
IsVisible="{TemplateBinding ShowTail}"
2526
Fill="{DynamicResource TeachingTipBackground}"
26-
HorizontalAlignment="Left"
27+
HorizontalAlignment="{TemplateBinding TailAlignment}"
2728
VerticalAlignment="Top"
2829
Stroke="{DynamicResource TeachingTipBorderBrush}"
2930
StrokeThickness="1"
3031
Data="M0,10 L10,0 L20,10"
31-
Margin="10,-10,0,0" />
32+
Margin="20,-10,20,0" />
3233
<!-- cover the tail -->
33-
<Border Width="18" Height="2" HorizontalAlignment="Left" VerticalAlignment="Top" Background="{DynamicResource TeachingTipBackground}"
34-
IsVisible="{TemplateBinding ShowTail}"
35-
Margin="11,0,0,0" />
3634
</Panel>
3735
</ControlTemplate>
3836
</Setter>
3937
</Style>
40-
<Style Selector="controls|BalloonPopup:showtail /template/ Panel#PART_RootPanel">
38+
<Style Selector="BalloonPopup:showtail /template/ Panel#PART_RootPanel">
4139
<Setter Property="Margin" Value="0,10,0,0"/> <!-- space for the tail -->
4240
</Style>
4341
</Styles>
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
using Avalonia;
22
using Avalonia.Controls;
33
using Avalonia.Controls.Primitives;
4+
using Avalonia.Layout;
45

5-
namespace WDE.SourceCodeIntegrationEditor.VisualStudioIntegration.Views;
6+
namespace AvaloniaStyles.Controls;
67

78
public class BalloonPopup : ContentControl
89
{
910
public static readonly StyledProperty<bool> ShowTailProperty = AvaloniaProperty.Register<BalloonPopup, bool>(nameof(ShowTail));
11+
public static readonly StyledProperty<HorizontalAlignment> TailAlignmentProperty = AvaloniaProperty.Register<BalloonPopup, HorizontalAlignment>(nameof(TailAlignment));
1012

1113
public bool ShowTail
1214
{
1315
get => GetValue(ShowTailProperty);
1416
set => SetValue(ShowTailProperty, value);
1517
}
1618

19+
public HorizontalAlignment TailAlignment
20+
{
21+
get => GetValue(TailAlignmentProperty);
22+
set => SetValue(TailAlignmentProperty, value);
23+
}
24+
1725
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
1826
{
1927
base.OnPropertyChanged(change);

AvaloniaStyles/Controls/ExtendedWindow.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ public class ExtendedWindow : Window
4040

4141
public static readonly StyledProperty<string> SubTitleProperty =
4242
AvaloniaProperty.Register<ExtendedWindow, string>(nameof(SubTitle));
43-
43+
44+
public static readonly StyledProperty<object?> TitleContentProperty
45+
= AvaloniaProperty.Register<ExtendedWindow, object?>(nameof (TitleContent));
46+
47+
public object? TitleContent
48+
{
49+
get => GetValue(TitleContentProperty);
50+
set => SetValue(TitleContentProperty, value);
51+
}
52+
4453
public IImage ManagedIcon
4554
{
4655
get => GetValue(ManagedIconProperty);

AvaloniaStyles/Controls/HamburgerMenuButton.axaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<Style Selector="controls|HamburgerMenuButton">
1515
<Setter Property="Template">
1616
<ControlTemplate>
17-
<Button Width="34" Height="34"
17+
<Button Width="34" Height="34" Background="{TemplateBinding Background}"
1818
IsVisible="{Binding $parent[TopLevel].(NativeMenu.Menu).Items, FallbackValue=False, Converter={StaticResource ListCountToBoolConverter}}">
1919
<Button.Content>
2020
<Path Fill="{Binding $parent[Button].Foreground}">
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using System;
2+
using Avalonia;
3+
using Avalonia.Controls;
4+
5+
namespace AvaloniaStyles.Controls;
6+
7+
public class ThreeSidesPanel : Panel
8+
{
9+
protected override Size MeasureOverride(Size availableSize)
10+
{
11+
double totalWidth = 0;
12+
double maxHeight = 0;
13+
foreach (var child in Children)
14+
{
15+
child.Measure(availableSize);
16+
maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
17+
totalWidth += child.DesiredSize.Width;
18+
}
19+
return new Size(totalWidth, maxHeight);
20+
}
21+
22+
protected override Size ArrangeOverride(Size finalSize)
23+
{
24+
double leftDesiredWidth = 0;
25+
double rightDesiredWidth = 0;
26+
double centerDesiredWidth = 0;
27+
Control? leftChild = null, centerChild = null, rightChild = null;
28+
for (var index = 0; index < Children.Count; index++)
29+
{
30+
var child = Children[index];
31+
var desiredWidth = child.DesiredSize.Width;
32+
if (index == 0)
33+
{
34+
leftDesiredWidth = desiredWidth;
35+
leftChild = child;
36+
}
37+
else if (index == 1)
38+
{
39+
rightDesiredWidth = desiredWidth;
40+
rightChild = child;
41+
}
42+
else if (index == 2)
43+
{
44+
centerDesiredWidth = 400;//desiredWidth;
45+
centerChild = child;
46+
}
47+
}
48+
49+
var totalWidth = finalSize.Width;
50+
51+
var leftSpaceLeft = Math.Max(0, totalWidth / 2 - leftDesiredWidth);
52+
var rightSpaceLeft = Math.Max(0, totalWidth / 2 - rightDesiredWidth);
53+
54+
var spaceLeft = leftSpaceLeft + rightSpaceLeft;
55+
centerDesiredWidth = Math.Min(spaceLeft, centerDesiredWidth);
56+
57+
leftDesiredWidth = Math.Min(totalWidth - rightDesiredWidth, leftDesiredWidth);
58+
59+
leftChild?.Arrange(new Rect(0, 0, leftDesiredWidth, finalSize.Height));
60+
var centerRect = new Rect(Math.Max(leftDesiredWidth, finalSize.Width / 2 - centerDesiredWidth / 2), 0,
61+
centerDesiredWidth, finalSize.Height);
62+
var rightRect = new Rect(finalSize.Width - rightDesiredWidth, 0, rightDesiredWidth, finalSize.Height);
63+
var overflowRight = Math.Max(0, centerRect.Right - rightRect.Left);
64+
centerRect = new Rect(centerRect.X - overflowRight, centerRect.Y, centerRect.Width, centerRect.Height);
65+
centerChild?.Arrange(centerRect);
66+
rightChild?.Arrange(rightRect);
67+
68+
return finalSize;
69+
}
70+
}

AvaloniaStyles/Styles/BigSur/ColorsDark.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<SolidColorBrush x:Key="ThemeForegroundBrush" Color="White" />
1919
<SolidColorBrush x:Key="MainColorBackground" Color="#303032" />
2020
<SolidColorBrush x:Key="ContentBackground" Color="#1E1E1E" />
21+
<SolidColorBrush x:Key="TitleBarHalfButtonBackground" Opacity="0.5" Color="#1E1E1E" />
2122
<SolidColorBrush Color="#292929" x:Key="SlightlyHighlightedBackground" />
2223
<SolidColorBrush x:Key="ContentAlternateRowBackground" Color="#292929" />
2324
<SolidColorBrush x:Key="MainColorForeground" Color="#EBEBEB" />

AvaloniaStyles/Styles/BigSur/ColorsLight.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<SolidColorBrush x:Key="ThemeForegroundBrush" Color="#282828" />
1616
<SolidColorBrush x:Key="MainColorBackground" Color="#F6F6F6" />
1717
<SolidColorBrush x:Key="ContentBackground" Color="White" />
18+
<SolidColorBrush x:Key="TitleBarHalfButtonBackground" Opacity="0.5" Color="White" />
1819
<SolidColorBrush Color="#F7F7F7" x:Key="SlightlyHighlightedBackground" />
1920
<SolidColorBrush x:Key="ContentAlternateRowBackground" Color="#F4F5F5" />
2021
<SolidColorBrush x:Key="MainColorForeground" Color="#282828" />

AvaloniaStyles/Styles/Catalina/ColorsDark.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<SolidColorBrush x:Key="ThemeForegroundBrush" Color="White" />
1919
<SolidColorBrush x:Key="MainColorBackground" Color="#303032" />
2020
<SolidColorBrush x:Key="ContentBackground" Color="#1E1E1E" />
21+
<SolidColorBrush x:Key="TitleBarHalfButtonBackground" Opacity="0.5" Color="#1E1E1E" />
2122
<SolidColorBrush Color="#292929" x:Key="SlightlyHighlightedBackground" />
2223
<SolidColorBrush x:Key="ContentAlternateRowBackground" Color="#292929" />
2324
<SolidColorBrush x:Key="MainColorForeground" Color="#EBEBEB" />

AvaloniaStyles/Styles/Catalina/ColorsLight.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<SolidColorBrush x:Key="ThemeForegroundBrush" Color="#282828" />
1919
<SolidColorBrush x:Key="MainColorBackground" Color="#ECECEC" />
2020
<SolidColorBrush x:Key="ContentBackground" Color="White" />
21+
<SolidColorBrush x:Key="TitleBarHalfButtonBackground" Opacity="0.5" Color="White" />
2122
<SolidColorBrush Color="#F7F7F7" x:Key="SlightlyHighlightedBackground" />
2223
<SolidColorBrush x:Key="ContentAlternateRowBackground" Color="#F4F5F5" />
2324
<SolidColorBrush x:Key="MainColorForeground" Color="#282828" />

AvaloniaStyles/Styles/Windows10/ColorsDark.axaml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
<SolidColorBrush Color="#3F3F45" x:Key="ContentBorderBrush" />
2323
<SolidColorBrush Color="#252526" x:Key="ContentBackground" />
24+
<SolidColorBrush Color="White" Opacity="0.1" x:Key="TitleBarHalfButtonBackground" />
2425
<SolidColorBrush Color="#171718" x:Key="SlightlyHighlightedBackground" />
2526

2627
<SolidColorBrush Color="#252526" x:Key="ThemeBackgroundBrush" />

AvaloniaStyles/Styles/Windows10/ColorsLight.axaml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
<SolidColorBrush Color="#74747F" x:Key="ContentBorderBrush" />
2222
<SolidColorBrush Color="White" x:Key="ContentBackground" />
23+
<SolidColorBrush Color="White" Opacity="0.5" x:Key="TitleBarHalfButtonBackground" />
2324
<SolidColorBrush Color="White" x:Key="ThemeBackgroundBrush" />
2425
<SolidColorBrush Color="#F7F7F7" x:Key="SlightlyHighlightedBackground" />
2526
<SolidColorBrush Color="#DAD9D8" x:Key="ThemeBorderMidBrush" />

AvaloniaStyles/Styles/Windows10/Style.axaml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<StyleInclude Source="avares://AvaloniaStyles/Controls/ToolbarControl.axaml" />
2525
<StyleInclude Source="avares://AvaloniaStyles/Controls/SettingItem.axaml" />
2626
<StyleInclude Source="avares://AvaloniaStyles/Controls/InfoBar/InfoBar.axaml" />
27+
<StyleInclude Source="avares://AvaloniaStyles/Controls/BalloonPopup.axaml" />
2728

2829
<!--<StyleInclude Source="avares://AvaloniaStyles/Styles/Windows10/TabStrip.xaml" />-->
2930
<StyleInclude Source="avares://AvaloniaStyles/Styles/Windows10/GridSplitter.axaml" />

0 commit comments

Comments
 (0)