Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling adjustments #354

Merged
merged 8 commits into from
Aug 31, 2023
2 changes: 1 addition & 1 deletion src/AvaloniaEdit.Demo/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:AvalonEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
xmlns:AvalonEdit="using:AvaloniaEdit"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinWidth="0"
MinHeight="300"
Expand Down
3 changes: 2 additions & 1 deletion src/AvaloniaEdit/CodeCompletion/CompletionList.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion">
xmlns:cc="using:AvaloniaEdit.CodeCompletion"
x:ClassModifier="internal">

<ControlTheme x:Key="{x:Type cc:CompletionListBox}" TargetType="cc:CompletionListBox"
BasedOn="{StaticResource {x:Type ListBox}}">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Avalonia.Controls;

namespace AvaloniaEdit.CodeCompletion;

public class CompletionTipContentControl : ContentControl
{

}
30 changes: 30 additions & 0 deletions src/AvaloniaEdit/CodeCompletion/CompletionTipContentControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:codeCompletion="using:AvaloniaEdit.CodeCompletion"
x:ClassModifier="internal">

<!-- Style used for tooltip next to completion list box. -->
<ControlTheme x:Key="{x:Type codeCompletion:CompletionTipContentControl}"
TargetType="{x:Type codeCompletion:CompletionTipContentControl}">
<Setter Property="BorderThickness" Value="{DynamicResource CompletionToolTipBorderThickness}" />
<Setter Property="BorderBrush" Value="{DynamicResource CompletionToolTipBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource CompletionToolTipBackground}" />
<Setter Property="Foreground" Value="{DynamicResource CompletionToolTipForeground}" />
<Setter Property="Padding" Value="4,2" />
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
</ControlTemplate>
</Setter>
</ControlTheme>

</ResourceDictionary>
5 changes: 2 additions & 3 deletions src/AvaloniaEdit/CodeCompletion/CompletionWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace AvaloniaEdit.CodeCompletion
public class CompletionWindow : CompletionWindowBase
{
private PopupWithCustomPosition _toolTip;
private ContentControl _toolTipContent;
private CompletionTipContentControl _toolTipContent;

/// <summary>
/// Gets the completion list used in this completion window.
Expand All @@ -55,8 +55,7 @@ public CompletionWindow(TextArea textArea) : base(textArea)
MinHeight = 15;
MinWidth = 30;

_toolTipContent = new ContentControl();
_toolTipContent.Classes.Add("ToolTip");
_toolTipContent = new CompletionTipContentControl();

_toolTip = new PopupWithCustomPosition
{
Expand Down
13 changes: 0 additions & 13 deletions src/AvaloniaEdit/CodeCompletion/CompletionWindow.xaml

This file was deleted.

5 changes: 0 additions & 5 deletions src/AvaloniaEdit/CodeCompletion/CompletionWindowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ namespace AvaloniaEdit.CodeCompletion
/// </summary>
public class CompletionWindowBase : Popup
{
static CompletionWindowBase()
{
//BackgroundProperty.OverrideDefaultValue(typeof(CompletionWindowBase), Brushes.White);
}

protected override Type StyleKeyOverride => typeof(PopupRoot);

/// <summary>
Expand Down
45 changes: 19 additions & 26 deletions src/AvaloniaEdit/CodeCompletion/InsightWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:AvaloniaEdit.CodeCompletion">
xmlns:cc="using:AvaloniaEdit.CodeCompletion"
x:ClassModifier="internal">
<ControlTheme x:Key="OverloadViewerButtonTheme"
TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="2,2,2,2" />
<Setter Property="Width" Value="9" />
<Setter Property="Height" Value="9" />
<Setter Property="CornerRadius" Value="2" />
</ControlTheme>

<ControlTheme x:Key="{x:Type cc:OverloadViewer}" TargetType="cc:OverloadViewer">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="Background" Value="#eeeeee" />
<Setter Property="BorderBrush" Value="{DynamicResource OverloadViewerBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource OverloadViewerBackground}" />
<Setter Property="Foreground" Value="{DynamicResource OverloadViewerForeground}" />
<Setter Property="Padding" Value="2" />
<Setter Property="Template">
<ControlTemplate>
Expand All @@ -20,17 +30,17 @@
Margin="0,0,4,0"
Orientation="Horizontal"
IsVisible="{Binding Provider.Count, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static cc:CollapseIfSingleOverloadConverter.Instance}}">
<Button Name="PART_UP">
<Path Stroke="Black"
Fill="Black"
<Button Name="PART_UP" Theme="{StaticResource OverloadViewerButtonTheme}">
<Path Stroke="{Binding #PART_UP.Foreground}"
Fill="{Binding #PART_UP.Foreground}"
Data="M 0,0.866 L 1,0.866 L 0.5,0 Z"
Stretch="UniformToFill" />
</Button>
<TextBlock Margin="2,0,2,0"
Text="{Binding Provider.CurrentIndexText, RelativeSource={RelativeSource TemplatedParent}}" />
<Button Name="PART_DOWN">
<Path Stroke="Black"
Fill="Black"
<Button Name="PART_DOWN" Theme="{StaticResource OverloadViewerButtonTheme}">
<Path Stroke="{Binding #PART_DOWN.Foreground}"
Fill="{Binding #PART_DOWN.Foreground}"
Data="M 0,0 L 1,0 L 0.5,0.866 Z"
Stretch="UniformToFill" />
</Button>
Expand All @@ -46,23 +56,6 @@
</Border>
</ControlTemplate>
</Setter>

<Style Selector="^/template/ Button">
<Setter Property="Background" Value="LightGray" />
<Setter Property="Padding" Value="2,2,2,2" />
<Setter Property="Width" Value="9" />
<Setter Property="Height" Value="9" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="bd"
Background="{TemplateBinding Background}"
CornerRadius="2">
<ContentPresenter Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}" />
</Border>
</ControlTemplate>
</Setter>
</Style>

</ControlTheme>
</ResourceDictionary>
5 changes: 3 additions & 2 deletions src/AvaloniaEdit/Editing/TextArea.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:editing="clr-namespace:AvaloniaEdit.Editing">
xmlns:editing="using:AvaloniaEdit.Editing"
x:ClassModifier="internal">
<ControlTheme x:Key="{x:Type editing:TextArea}" TargetType="editing:TextArea">
<Setter Property="SelectionBrush" Value="#660000ff" />
<Setter Property="SelectionBrush" Value="{DynamicResource TextAreaSelectionBrush}" />
<!--<Setter Property="SelectionBorder">
<Pen Brush="#0000ff" Thickness="1" />
</Setter>-->
Expand Down
8 changes: 0 additions & 8 deletions src/AvaloniaEdit/Rendering/VisualLineDrawingVisual.xaml

This file was deleted.

5 changes: 3 additions & 2 deletions src/AvaloniaEdit/Search/SearchPanel.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ae="clr-namespace:AvaloniaEdit"
xmlns:search="clr-namespace:AvaloniaEdit.Search">
xmlns:ae="using:AvaloniaEdit"
xmlns:search="using:AvaloniaEdit.Search"
x:ClassModifier="internal">

<Design.PreviewWith>
<Border Padding="20">
Expand Down
3 changes: 2 additions & 1 deletion src/AvaloniaEdit/TextEditor.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avaloniaedit="clr-namespace:AvaloniaEdit">
xmlns:avaloniaedit="using:AvaloniaEdit"
x:ClassModifier="internal">
<ControlTheme x:Key="{x:Type avaloniaedit:TextEditor}" TargetType="avaloniaedit:TextEditor">
<Setter Property="Template">
<ControlTemplate>
Expand Down
11 changes: 11 additions & 0 deletions src/AvaloniaEdit/Themes/Base.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="/TextEditor.xaml" />
<MergeResourceInclude Source="/Editing/TextArea.xaml" />
<MergeResourceInclude Source="/CodeCompletion/CompletionTipContentControl.xaml" />
<MergeResourceInclude Source="/CodeCompletion/CompletionList.xaml" />
<MergeResourceInclude Source="/CodeCompletion/InsightWindow.xaml" />
<MergeResourceInclude Source="/Search/SearchPanel.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
42 changes: 32 additions & 10 deletions src/AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
<Styles xmlns="https://github.com/avaloniaui">
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Styles.Resources>
<ResourceDictionary>
<StaticResource x:Key="SearchPanelFontSize" ResourceKey="ControlContentThemeFontSize" />
<StaticResource x:Key="SearchPanelFontFamily" ResourceKey="ContentControlThemeFontFamily" />
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<StaticResource x:Key="CompletionToolTipBackground" ResourceKey="ToolTipBackground" />
<StaticResource x:Key="CompletionToolTipForeground" ResourceKey="ToolTipForeground" />
<StaticResource x:Key="CompletionToolTipBorderBrush" ResourceKey="ToolTipBorderBrush" />
<StaticResource x:Key="CompletionToolTipBorderThickness" ResourceKey="ToolTipBorderThemeThickness" />
<StaticResource x:Key="OverloadViewerBackground" ResourceKey="ToolTipBackground" />
<StaticResource x:Key="OverloadViewerForeground" ResourceKey="ToolTipForeground" />
<StaticResource x:Key="OverloadViewerBorderBrush" ResourceKey="ToolTipBorderBrush" />
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource SystemChromeMediumColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource SystemBaseLowColor}" />
<SolidColorBrush x:Key="TextAreaSelectionBrush" Color="{DynamicResource SystemAccentColor}" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<StaticResource x:Key="CompletionToolTipBackground" ResourceKey="ToolTipBackground" />
<StaticResource x:Key="CompletionToolTipForeground" ResourceKey="ToolTipForeground" />
<StaticResource x:Key="CompletionToolTipBorderBrush" ResourceKey="ToolTipBorderBrush" />
<StaticResource x:Key="CompletionToolTipBorderThickness" ResourceKey="ToolTipBorderThemeThickness" />
<StaticResource x:Key="OverloadViewerBackground" ResourceKey="ToolTipBackground" />
<StaticResource x:Key="OverloadViewerForeground" ResourceKey="ToolTipForeground" />
<StaticResource x:Key="OverloadViewerBorderBrush" ResourceKey="ToolTipBorderBrush" />
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource SystemChromeMediumColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource SystemBaseLowColor}" />
<SolidColorBrush x:Key="TextAreaSelectionBrush" Color="{DynamicResource SystemAccentColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="/Themes/Fluent/Base.xaml" />
<ResourceInclude Source="/TextEditor.xaml" />
<ResourceInclude Source="/Editing/TextArea.xaml" />
<ResourceInclude Source="/CodeCompletion/CompletionList.xaml" />
<ResourceInclude Source="/CodeCompletion/InsightWindow.xaml" />
<ResourceInclude Source="/Search/SearchPanel.xaml" />
<ResourceInclude Source="../Base.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>

<StyleInclude Source="/CodeCompletion/CompletionWindow.xaml" />
<StyleInclude Source="/Rendering/VisualLineDrawingVisual.xaml" />
</Styles>
23 changes: 0 additions & 23 deletions src/AvaloniaEdit/Themes/Fluent/Base.xaml

This file was deleted.

42 changes: 32 additions & 10 deletions src/AvaloniaEdit/Themes/Simple/AvaloniaEdit.xaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
<Styles xmlns="https://github.com/avaloniaui">
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Styles.Resources>
<ResourceDictionary>
<StaticResource x:Key="SearchPanelFontSize" ResourceKey="FontSizeNormal" />
<StaticResource x:Key="SearchPanelFontFamily" ResourceKey="ContentControlThemeFontFamily" />
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<StaticResource x:Key="CompletionToolTipBackground" ResourceKey="ThemeBackgroundBrush" />
<StaticResource x:Key="CompletionToolTipForeground" ResourceKey="ThemeForegroundColor" />
<StaticResource x:Key="CompletionToolTipBorderBrush" ResourceKey="ThemeBorderMidBrush" />
<StaticResource x:Key="CompletionToolTipBorderThickness" ResourceKey="ThemeBorderThickness" />
<StaticResource x:Key="OverloadViewerBackground" ResourceKey="ThemeBackgroundBrush" />
<StaticResource x:Key="OverloadViewerForeground" ResourceKey="ThemeForegroundColor" />
<StaticResource x:Key="OverloadViewerBorderBrush" ResourceKey="ThemeBorderMidBrush" />
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource ThemeBackgroundColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="TextAreaSelectionBrush" Color="{DynamicResource HighlightBrush}" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<StaticResource x:Key="CompletionToolTipBackground" ResourceKey="ThemeBackgroundBrush" />
<StaticResource x:Key="CompletionToolTipForeground" ResourceKey="ThemeForegroundColor" />
<StaticResource x:Key="CompletionToolTipBorderBrush" ResourceKey="ThemeBorderMidBrush" />
<StaticResource x:Key="CompletionToolTipBorderThickness" ResourceKey="ThemeBorderThickness" />
<StaticResource x:Key="OverloadViewerBackground" ResourceKey="ThemeBackgroundBrush" />
<StaticResource x:Key="OverloadViewerForeground" ResourceKey="ThemeForegroundColor" />
<StaticResource x:Key="OverloadViewerBorderBrush" ResourceKey="ThemeBorderMidBrush" />
<SolidColorBrush x:Key="SearchPanelBackgroundBrush" Color="{DynamicResource ThemeBackgroundColor}" />
<SolidColorBrush x:Key="SearchPanelBorderBrush" Color="{DynamicResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="TextAreaSelectionBrush" Color="{DynamicResource HighlightBrush}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="/Themes/Simple/Base.xaml" />
<ResourceInclude Source="/TextEditor.xaml" />
<ResourceInclude Source="/Editing/TextArea.xaml" />
<ResourceInclude Source="/CodeCompletion/CompletionList.xaml" />
<ResourceInclude Source="/CodeCompletion/InsightWindow.xaml" />
<ResourceInclude Source="/Search/SearchPanel.xaml" />
<ResourceInclude Source="../Base.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>

<StyleInclude Source="/CodeCompletion/CompletionWindow.xaml" />
<StyleInclude Source="/Rendering/VisualLineDrawingVisual.xaml" />
</Styles>
Loading