簡體   English   中英

如何設置wpf xaml中文本框的提示文字和提示文字顏色?

[英]How to set the hint text and hint text color of textbox in wpf xaml?

我想在 xaml 文本框中制作提示文本並設置提示文本顏色。 有沒有辦法直接在 xaml 文件的文本框中設置提示文本和提示文本顏色? 請讓我知道路。

我使用 MaterialDesignThemes。 下載 NuGet 和我們如下:

xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 

<TextBox materialDesign:HintAssist.Hint="Floating Hint" Style="{StaticResource MaterialDesignFloatingHintTextBox}" VerticalAlignment="Center"/>

您還需要在 App.xaml 中進行以下更改

<ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.DeepPurple.xaml" />
        </ResourceDictionary.MergedDictionaries>

材料設計入門

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM