Start Debugging

.NET MAUI で SearchBar のアイコン色を変更する方法

.NET 10 で導入された新しい SearchIconColor プロパティを使って、.NET MAUI の SearchBar のアイコン色を変更する方法。

.NET 10 から、MAUI のサーチバーには SearchBar の検索アイコンの色を変更するための新しいプロパティ SearchIconColor が追加されました。

他のバインド可能なプロパティと同様に、Purple のような色の値を割り当てたり、次のようにリソースにバインドしたりできます。

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <SearchBar Placeholder="Search videos..." SearchIconColor="{StaticResource Primary}" />
    <ScrollView>
        <VerticalStackLayout>
            
        </VerticalStackLayout>
    </ScrollView>
</Grid>

Comments

Sign in with GitHub to comment. Reactions and replies thread back to the comments repo.

< 戻る