spiegelp / MaterialDesignExtensions

Material Design Extensions is based on Material Design in XAML Toolkit to provide additional controls and features for WPF apps
https://spiegelp.github.io/MaterialDesignExtensions/
MIT License
762 stars 122 forks source link

AutoComplete Activation Indicator #25

Closed Imadlekal closed 5 years ago

Imadlekal commented 5 years ago

Is it possible to remove the Activation indicator that shows under the text you write?

image

spiegelp commented 5 years ago

@Imadlekal There is no API to control that. The Autocomplete uses a style out of Material Design in XAML Toolkit for the TextBox. You just need to define a new ControlTemplate for the Underline inside your Autocomplete. The following snippet renders the Underline as a Border width no size:

<!-- namespace definitions -->
xmlns:wpfLib="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"

<!-- add a ControlTemplate to Underlune inside the Autocomplete.Resources -->
<controls:Autocomplete>
    <controls:Autocomplete.Resources>
        <Style TargetType="{x:Type wpfLib:Underline}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type wpfLib:Underline}">
                        <Border Width="0" Height="0" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </controls:Autocomplete.Resources>
</controls:Autocomplete>