6

I'm trying to figure out how to change the style of the AvalonEdit CodeCompletion window. However, I can't figure out the right combination of xaml style target/properties to change it. The main thing I'd like to do is get rid of the border, but maybe some additional changes as well.

Here is the xaml I've tried. None of it is affecting the UI.

    xmlns:ae="clr-namespace:ICSharpCode.AvalonEdit.CodeCompletion;assembly=ICSharpCode.AvalonEdit"

    <Style TargetType="{x:Type ae:CompletionWindow}">
        <Setter Property="WindowStyle" Value="None" />
    </Style>
    <Style TargetType="{x:Type ae:CompletionWindowBase}">
        <Setter Property="WindowStyle" Value="None" />
    </Style>
    <Style TargetType="{x:Type ae:CompletionListBox}">
        <Setter Property="Background" Value="Red" />
    </Style>
    <Style TargetType="{x:Type ae:CompletionList}">
        <Setter Property="Background" Value="Orange" />
    </Style>
Keith G
  • 4,580
  • 5
  • 38
  • 48

2 Answers2

4

Use this style to remove border on window:

<Style TargetType="{x:Type avalonEdit:CompletionWindow}">
    <Setter Property="WindowStyle" Value="None"></Setter>
    <Setter Property="ResizeMode" Value="NoResize"></Setter>
    <Setter Property="BorderThickness" Value="0"></Setter>
</Style>
チーズパン
  • 2,752
  • 8
  • 42
  • 63
  • For posterity in case it helps anyone, I was trigger my completion window via code and this Style wasn't picking. I had to set the style on my completion window in C# in case anyone is invoking it that way and not seeing the styles apply. – b.pell Jul 31 '22 at 17:02
-2

To make the styles affect the UI, you can put them in a resource dictionary xaml and parse that with (ResourceDictionary)XamlReader.Parse(ResourcesAsXaml). Then assign the ResourceDictionary to the Resources property of the CompletionWindow.

Michael Rätzel
  • 401
  • 1
  • 6
  • 17