Multiline tooltips working again

This commit is contained in:
Hendrik Mennen 2019-08-19 17:41:40 +02:00
Родитель 24cf2c0872
Коммит b4c9ffbd71
3 изменённых файлов: 15 добавлений и 11 удалений

Просмотреть файл

@ -114,10 +114,13 @@ namespace AvaloniaEdit.Demo
data.Add(new MyCompletionData("Item7"));
data.Add(new MyCompletionData("Item8"));
data.Add(new MyCompletionData("Item9"));
data.Add(new MyCompletionData("Item10"));
data.Add(new MyCompletionData("Item11"));
data.Add(new MyCompletionData("Item12"));
data.Add(new MyCompletionData("Item13"));
_completionWindow.Show();
_completionWindow.Height = double.NaN;
_completionWindow.VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch;
}
else if (e.Text == "(")
{

Просмотреть файл

@ -21,18 +21,18 @@
</Setter>
</Style>
<Style Selector="ListBoxItem">
<Setter Property="Height" Value="20"/>
<Setter Property="Margin" Value="0"/>
<Style Selector="cc|CompletionList > ListBox">
<Setter Property="Padding" Value="0"/>
</Style>
<Style Selector="ListBox">
<Setter Property="Padding" Value="0"/>
<Style Selector="cc|CompletionList > ListBox > ListBoxItem">
<Setter Property="Padding" Value="4, 0, 0, 0"/>
<Setter Property="Height" Value="20"/>
</Style>
<Style Selector="ContentControl.ToolTip">
<Setter Property="Height" Value="22"/>
<Setter Property="MinHeight" Value="22"/>
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="BorderBrush"

Просмотреть файл

@ -51,12 +51,12 @@ namespace AvaloniaEdit.CodeCompletion
CompletionList = new CompletionList();
// keep height automatic
CloseAutomatically = true;
MaxHeight = 300;
MaxHeight = 225;
Width = 175;
Content = CompletionList;
// prevent user from resizing window to 0x0
MinHeight = 15;
MinWidth = 30;
MinWidth = 30;
_toolTipContent = new ContentControl();
_toolTipContent.Classes.Add("ToolTip");
@ -120,9 +120,10 @@ namespace AvaloniaEdit.CodeCompletion
int scrollIndex = (int)CompletionList.ListBox.Scroll.Offset.Y;
int yoffset = index - scrollIndex;
if (yoffset < 0) yoffset = 0;
if ((yoffset+1) * 20 > MaxHeight) yoffset--;
_toolTip.Offset = new PixelPoint(2, yoffset * 20); //Todo find way to measure item height
Console.WriteLine(scrollIndex + " " + index);
Console.WriteLine(CompletionList.ListBox.ScrollViewer.Offset.Y + " " + index);
}
_toolTip.IsOpen = true;
}