How to Change the Style on AvalonEdit CodeCompletion Window?
Asked Answered
I

2

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>
Ichor answered 15/10, 2015 at 12:52 Comment(0)
M
6

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>
Monarch answered 29/11, 2016 at 11:45 Comment(1)
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.Pontifical
F
-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.

Futurity answered 3/11, 2015 at 19:31 Comment(3)
How is that different than putting the resources directly in the xaml file or in the App.xaml file?Ichor
There are different ways to achieve the effect, App.xaml works too.Mieshamiett
@Michael Rätzel did you at least try your solution?Colonialism

© 2022 - 2024 — McMap. All rights reserved.