如何在UWP中更改Autosuggestbox建议列表的颜色?

时间:2017-06-12 12:04:37

标签: wpf xaml uwp

我坚持这一点,如何更改UWP中Autosuggestbox建议列表的颜色?它总是以深灰色显示。

enter image description here

2 个答案:

答案 0 :(得分:1)

最简单的方法是覆盖AutoSuggestBoxSuggestionsListBackground中的App.xaml

<Application.Resources>
    <SolidColorBrush x:Key="AutoSuggestBoxSuggestionsListBackground">White</SolidColorBrush>
</Application.Resources>

或者您可以使用VS / Blend Designer生成默认样式,然后找到此行 -

<ListView x:Name="SuggestionsList" BorderBrush="{ThemeResource AutoSuggestBoxSuggestionsListBorderBrush}" BorderThickness="{ThemeResource AutoSuggestListBorderThemeThickness}" Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}" DisplayMemberPath="{TemplateBinding DisplayMemberPath}" IsItemClickEnabled="True" ItemTemplate="{TemplateBinding ItemTemplate}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}" ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}" MaxHeight="{ThemeResource AutoSuggestListMaxHeight}" Margin="{ThemeResource AutoSuggestListMargin}" Padding="{ThemeResource AutoSuggestListPadding}">

然后将Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}"替换为Background="White"

答案 1 :(得分:-1)

在您的autosuggestbox中:

<AutoSuggestBox background="transparent"/>